Quick Overview
This workflow triggers on new Shopify orders, checks whether they match your wholesale/B2B criteria using the Shopify Admin GraphQL API, and sends an HTML email alert via SMTP when a qualifying order is detected.
How it works
- Triggers in Shopify when a new order is created.
- Loads configurable settings such as shop subdomain, wholesale tag, minimum order value, and alert email addresses.
- Queries the Shopify Admin GraphQL API to fetch the customer’s tags and (for B2B) the purchasing company and location details that aren’t included in the order webhook.
- Evaluates the order against the wholesale rules (B2B company order and/or matching wholesale tags, plus the minimum order value) and generates a formatted HTML email with order details and a Shopify admin link.
- Sends the email alert via SMTP only when the order qualifies as wholesale/B2B.
Setup
- Create and install a Shopify app with
read_orders and read_customers scopes, and connect it to n8n using a Shopify OAuth2 API credential.
- Add an SMTP credential for sending mail and select it in the email-sending step.
- Update the Settings values (shop subdomain, wholesale tag, minimum order value, and to/from email addresses) before activating the workflow.