Automatically Update Shopify Prices Based on Zendrop Product Costs to Protect Your Margins
This recipe fetches your latest product costs from Zendrop via API, calculates a selling price using your target margin, and updates Shopify product prices automatically. Dropshippers never have to manually reprice when supplier costs change.
- 1
Schedule the workflow to run on a regular cadence
Add a
Schedule Triggernode. Set theRuleto run daily (or every few hours if costs change frequently). This kicks off the repricing process automatically without any manual action. You can adjust the interval in theTrigger Timesfield. - 2
Fetch your product costs from Zendrop
Add an
HTTP Requestnode. SetMethodto GET andURLto your Zendrop API endpoint, for examplehttps://app.zendrop.com/api/v1/products. Add your Zendrop API key in theHeaderssection asAuthorization: Bearer YOUR_API_KEY. The response will contain a list of products with their current cost prices. Store your API key safely in n8n credentials and reference it here. - 3
Calculate the new selling price with your target margin
Add a
Setnode. Create a new field callednewPrice. Use the expression{{ ($json.cost / (1 - 0.40)).toFixed(2) }}to apply a 40% margin — replace 0.40 with your desired margin decimal. Also map throughproduct_idand any other identifiers returned by Zendrop so you can match to Shopify. Adjust field names to match exactly what Zendrop returns in its JSON response. - 4
Look up the matching Shopify product by SKU or ID
Add an
HTTP Requestnode. SetMethodto GET andURLtohttps://YOUR-STORE.myshopify.com/admin/api/2024-01/variants.json?sku={{ $json.sku }}. Add aHeader Authcredential with your Shopify Admin API access token using header nameX-Shopify-Access-Token. This returns the Shopify variant ID needed for the price update. ReplaceYOUR-STOREwith your actual Shopify subdomain. - 5
Update the Shopify product variant price
Add a final
HTTP Requestnode. SetMethodto PUT andURLtohttps://YOUR-STORE.myshopify.com/admin/api/2024-01/variants/{{ $json.variants[0].id }}.json. SetBody Content Typeto JSON and use this body:{ "variant": { "id": "{{ $json.variants[0].id }}", "price": "{{ $node['Set'].json.newPrice }}" } }. Add the same Shopify Admin API credential header. This writes the newly calculated price directly to your live Shopify listing.
Frequently asked questions
What margin percentage should I use in the Set node?
A common starting point for dropshippers is 30-50%. The formula `cost / (1 - margin)` gives you the revenue needed to achieve that gross margin. For example, a $10 cost at 40% margin gives a $16.67 price. Adjust the decimal in the expression to match your business model and factor in Shopify transaction fees and ad spend.
How do I find my Zendrop API key?
Log into your Zendrop account, go to Settings, then scroll to the API or Integrations section. Copy your API key from there. If you do not see an API section, check that you are on a paid Zendrop plan, as API access may require a Plus or Pro subscription. Paste the key into the n8n HTTP Request node header field as shown in Step 2.
Will this workflow overwrite prices I have manually set for promotions?
Yes, every time the workflow runs it will recalculate and overwrite existing prices. To protect promotional prices, add an `IF` node between the Set node and the final HTTP Request that checks whether a product is tagged as 'on-sale' in Shopify, and only proceeds with the update if the tag is absent. This adds one extra node but keeps your sale prices intact.