Free n8n template

Shopify order exception checks n8n template

What it does

Each new Shopify order is checked in code for address problems, PO boxes on carriers that cannot deliver to them, country mismatches, Shopify's risk recommendation, oversold items and repeat orders. Claude reads only the order notes and line item properties. Exceptions are tagged, optionally held, posted to Slack with a drafted customer email and logged to Google Sheets. You need n8n, a Shopify custom app, an Anthropic API key, Slack and Google Sheets.

What this workflow does

  1. Shopify: order created (Shopify Trigger) registers the orders/create webhook and verifies Shopify’s HMAC signature on every delivery.
  2. Shopify: risk, stock and fulfillment orders (HTTP Request, GraphQL Admin API) loads the order’s risk recommendation, current inventory for each variant and its fulfillment orders.
  3. Rule checks and build prompt (Code) runs deterministic checks and returns reason codes: exc-address, exc-pobox, exc-country, exc-risk, exc-oversell and exc-duplicate. It collects only the free text (order note, note attributes, visible line item properties) for the model. Payment details are never sent.
  4. Has free text? (If) skips the model call when there is nothing to read.
  5. Claude: classify order notes (HTTP Request) classifies the text as a change request, delivery instruction, gift message, complaint or nothing actionable, quotes the triggering sentence and drafts a customer email, using structured outputs at low effort.
  6. Decide exception (Code) handles refusal, max_tokens and API errors (flagged as exc-note-unread), merges all reasons and builds one GraphQL mutation that adds the tags and, outside shadow mode, places a fulfillment hold on each open fulfillment order.
  7. Exception? (If) leaves clean orders alone. Shopify: tag and hold order applies the mutation.
  8. Slack: exception for review posts the order, reasons, any tag or hold errors, the suggested email and an admin link. Log exception adds a row to Google Sheets for weekly trend review.

Before you import

  • A Shopify custom app with order, fulfillment order and inventory scopes, added to n8n as a Shopify Access Token credential. The app secret is used for webhook verification. Custom apps created in the Shopify admin before January 1, 2026 show a static access token. Newer ones are created in Shopify’s Dev Dashboard, where client credentials tokens expire after 24 hours, so plan how n8n gets a current token.
  • An Anthropic API key, a Slack app with chat:write, and a Google Sheet with an “Order exceptions” tab.

Setup

  1. Attach credentials, then replace REPLACE_WITH_SHOP in the two GraphQL URLs and the Slack message. Keep the API version in the URL inside Shopify’s support window.
  2. In Rule checks and build prompt, adjust PO_BOX_BLOCKED_CARRIERS and DUPLICATE_WINDOW_MINUTES. Leave SHADOW_MODE = true for the first week.
  3. Set REPLACE_WITH_SLACK_CHANNEL_ID and REPLACE_WITH_SHEET_ID, and add the column headers shown on the Sheets node.
  4. Activate the workflow so the trigger registers its webhook.

Test it

Place test orders on a development store: one clean, one shipping UPS to a PO box, one with “please change to size M” in the note, and the same email and address twice. Confirm the clean order produces nothing, and each other order gets the right tags, a Slack message and a sheet row.

Make it production-ready

  • Compare a week of shadow-mode tags with what your team caught by hand, then set SHADOW_MODE = false. Check that holds land before your 3PL or ShipStation connector pulls the order.
  • Add release and cancel actions for reviewers, and subscribe to orders/updated for edits.
  • Duplicate detection uses workflow static data, which only persists in an active workflow.
  • Add an error workflow, and watch GraphQL Admin API rate limits during sales.
  • claude-haiku-5-5 is a cheaper option for note classification at volume.

Read the full guide at How to automate Shopify order exceptions, see our Shopify notes, or talk to us.

Next steps