Finance & Ops · n8n

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.

difficulty Intermediatesetup 45 minresult Every time the workflow runs, your Shopify product prices are recalculated and updated to reflect current Zendrop costs plus your desired profit margin, keeping you profitable without manual effort.
  1. 1

    Schedule the workflow to run on a regular cadence

    Add a Schedule Trigger node. Set the Rule to 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 the Trigger Times field.

  2. 2

    Fetch your product costs from Zendrop

    Add an HTTP Request node. Set Method to GET and URL to your Zendrop API endpoint, for example https://app.zendrop.com/api/v1/products. Add your Zendrop API key in the Headers section as Authorization: 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. 3

    Calculate the new selling price with your target margin

    Add a Set node. Create a new field called newPrice. 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 through product_id and 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. 4

    Look up the matching Shopify product by SKU or ID

    Add an HTTP Request node. Set Method to GET and URL to https://YOUR-STORE.myshopify.com/admin/api/2024-01/variants.json?sku={{ $json.sku }}. Add a Header Auth credential with your Shopify Admin API access token using header name X-Shopify-Access-Token. This returns the Shopify variant ID needed for the price update. Replace YOUR-STORE with your actual Shopify subdomain.

  5. 5

    Update the Shopify product variant price

    Add a final HTTP Request node. Set Method to PUT and URL to https://YOUR-STORE.myshopify.com/admin/api/2024-01/variants/{{ $json.variants[0].id }}.json. Set Body Content Type to 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.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.