See llms.txt for all machine-readable content.

Back to Templates

Handle idempotent Shopify order webhooks with fast 200 OK responses

Quick overview

Shopify retries a webhook when it doesn't get a fast response, so the same order can arrive twice. This workflow answers 200 OK right away, drops repeated events using the X-Shopify-Webhook-Id header, and passes only new orders on.

How it works

  1. A Webhook node receives the Shopify order event (HTTP POST).
  2. A Respond to Webhook node sends 200 OK immediately, so Shopify doesn't time out and retry while your logic is still running.
  3. A Remove Duplicates node checks the X-Shopify-Webhook-Id header. This ID stays the same on every retry of the same event, so if n8n has already seen it in a previous execution, the item is dropped.
  4. A Set node picks the useful fields: webhook ID, order ID, order name, email, total price and currency.
  5. Only new, unique orders reach the last node, where you add your own logic.

Setup

  1. Import the workflow and publish it. Deduplication only works on production executions, not on test runs.
  2. Copy the Production URL from the Shopify Webhook node.
  3. In Shopify Admin, go to Settings → Notifications → Webhooks, create a webhook for "Order creation" in JSON format and paste the URL. Shopify sends the X-Shopify-Webhook-Id header with every webhook, so no extra setting is needed.
  4. Replace the "Your Business Logic" node with your own steps (ERP, Google Sheets, Slack, a database) and map any extra fields you need in "Map Order Fields".

Requirements

  • A Shopify store with permission to create webhooks
  • An n8n instance reachable from the internet (n8n Cloud, or self-hosted with a public URL)
  • Tested on n8n 2.46. Uses the Remove Duplicates node (v2)
  • No credentials needed

Customization

  • Other topics: use the same pattern for orders/updated, orders/paid or refunds/create. Keep one workflow per topic so the dedupe history stays separate.
  • History size: Remove Duplicates remembers the last 10,000 keys by default. Raise it in the node options if you get a lot of traffic.
  • Signature check: add a Code node after the webhook that verifies the X-Shopify-Hmac-Sha256 header with your app's secret, so nobody can post fake orders to your URL.
  • More fields: add line items, shipping address or tags in the "Map Order Fields" node.

Additional info

Don't use the order ID as the dedupe key. One order creates many different events (created, paid, updated), and those are real events, not duplicates.

Limitation: if your business logic fails after the key is saved, that event won't run again by itself. For important flows, connect an error workflow that stores failed events so you can retry them.