Shopify Order Fulfillment & Shipping Automation
A growing Shopify store was losing 3+ hours daily to manual order processing across 45-60 orders. Built a webhook-driven pipeline with domestic/international routing that brought that to near zero.
8% → 0.3%
$2,400/mo
15-20 hrs/week
The Client's Problem
My Approach
The Workflow Breakdown
Shopify webhook receives the order. When a customer completes checkout, Shopify fires a webhook to the n8n instance. The trigger node captures the full order payload -- line items, customer details, shipping address, pricing, and metadata -- in real time, with no delay or polling interval.
Key fields are extracted and normalized. A Set node pulls out the critical data points: order ID, order number, customer name, email, line items array, full shipping address, country code, total price, and currency. This normalization step ensures downstream nodes work with a clean, predictable data structure regardless of how Shopify formats edge cases.
Order validation runs automatically. A Code node executes validation logic that checks for missing customer emails, empty shipping addresses, missing city or zip codes, line items with zero or negative quantities, missing SKUs, and suspiciously large order quantities (over 100 units of a single item). Orders exceeding $10,000 are flagged for manual review. If any validation fails, the workflow throws a descriptive error that gets caught by the error handler.
The workflow determines domestic vs. international routing. An IF node checks whether the shipping country code equals "US." This single branch point drives significantly different downstream behavior -- domestic orders get USPS Priority shipping from the US-EAST warehouse, while international orders route through DHL Express from the international hub with customs documentation attached.
Domestic orders receive standard fulfillment formatting. For US-bound shipments, a Set node assigns USPS Priority as the carrier, US-EAST-01 as the fulfillment warehouse, estimates 3-5 business day delivery, and flags the order as not requiring customs paperwork.
International orders receive enhanced fulfillment formatting. Non-US shipments get DHL Express as the carrier, route through the US-INTL-HUB warehouse, estimate 7-14 business day delivery, and are flagged as requiring CN22 customs forms and HS codes. A duties disclaimer is attached noting the customer is responsible for import fees.
The order is logged to the master tracking spreadsheet. A Google Sheets node appends a new row to the Order Tracking sheet with the order number, customer name, email, itemized product list, item count, total price, shipping country, fulfillment type, assigned carrier, warehouse, processing status, and timestamp. This sheet serves as the single source of truth for the operations team.
A structured warehouse email is generated. A Code node builds a professional HTML email containing a styled order summary table (item name, quantity, SKU, price), formatted shipping address, carrier and warehouse assignment, estimated delivery window, and specific packing instructions. International orders get an additional highlighted section with customs form requirements, HS code reminders, and duties notices. Large orders (10+ items) trigger a special alert reminding the warehouse to double-check packing.
The fulfillment email is sent to the warehouse. Gmail sends the formatted email to the warehouse team with a CC to the operations manager. The subject line includes the order number, item count, fulfillment type (DOMESTIC/INTERNATIONAL), and assigned carrier for quick scanning in the inbox.
Inventory is decremented via the Shopify API. An HTTP Request node calls Shopify's inventory adjustment endpoint to reduce available stock for each item in the order. The location ID is dynamically selected based on whether the order routes through the domestic or international warehouse, ensuring inventory counts stay accurate per location.
A separate scheduled process monitors shipping status. Every 30 minutes, a Schedule Trigger fires and queries the carrier's tracking API for any shipments that have been updated in the last 30 minutes. This polling approach was chosen because most carrier APIs do not support webhooks for status changes.
Shipped orders trigger customer notifications. When the carrier API reports a status of "shipped," a Code node generates a branded, mobile-responsive HTML email with the tracking number, carrier name, estimated delivery date, and a prominent one-click "Track Your Package" button linking directly to the carrier's tracking page.
The shipping confirmation email is sent to the customer. Gmail delivers the confirmation email to the customer's address with a reply-to set to the support team, so any customer questions route to the right inbox.
The tracking spreadsheet is updated. The Google Sheets node updates the matching order row with the tracking number, shipped timestamp, estimated delivery date, and changes the status from "Processing" to "Shipped."
Any failures trigger immediate Slack alerts. If any node in the workflow fails, the Error Trigger catches the exception, a Code node extracts the error message, the specific node that failed, the affected order number and customer info (when available), the execution ID, and the timestamp. This is posted to the #operations Slack channel with a direct link to the failed execution in n8n for one-click debugging.
Results & Impact
Technical Highlights
- Webhook-driven real-time processing: Orders are captured and begin processing within seconds of Shopify checkout completion, using Shopify's native webhook infrastructure rather than periodic API polling. This eliminates the processing delay and reduces API call volume compared to a polling-based approach.
- Conditional routing engine for international fulfillment: The workflow dynamically branches based on shipping destination, assigning the appropriate carrier, warehouse, shipping method, estimated delivery window, and customs documentation requirements. This single branch point drives six different downstream data transformations.
- Automated inventory synchronization: The workflow calls Shopify's inventory adjustment API immediately after warehouse notification, with location-aware stock decrements that prevent overselling across the domestic and international warehouse locations.
- Structured error handling with contextual Slack alerts: Rather than generic error notifications, the error handler extracts the specific order that was being processed when the failure occurred, the exact node that failed, and generates a deep link to the n8n execution log. This reduced mean time to resolution from hours to minutes.
- Dual-pipeline architecture with independent triggers: The order intake pipeline and shipping monitoring pipeline operate as independent flows within the same workflow, each with its own trigger mechanism (webhook vs. scheduled polling). This separation of concerns means a failure in shipping monitoring never blocks order intake processing.
Tools Used
Shopify API, Google Sheets API, Gmail API, Slack API, n8n, REST APIs, Webhooks, JavaScript, HTML Email Templating