AI/ML
n8n Shopify Inventory Automation: Sync Across All Sales Channels
Overview
n8n detects sales on Shopify or Amazon, then updates inventory across all platforms and a central Google Sheets tracker.
Prerequisites
- n8n installed.
- Shopify and Amazon Seller Central accounts with webhooks.
- Google Sheets API enabled.
Workflow Setup
Prepare n8n Environment
Navigate to http://localhost:5678 (or your n8n hosted URL) and log in with your credentials.
In the sidebar, click “Workflows,” then select “+ New” and name it (e.g., “Campaign Tracker”). Click “+” on the canvas to open the node selector.
Trigger Node: Shopify Webhook
Node: Webhook
Settings:
Path: shopify-sale
Shopify Webhook: “Order Creation” at https://<n8n-host>/webhook/shopify-sale
Output: Sale data (e.g., {{ $json.body.line_items[0].sku }}).
Update Shopify Node: Shopify
Node: Shopify
Settings:
Credentials: Shopify API key
Resource: Inventory
Operation: Update
SKU: {{ $node["Webhook"].json.body.line_items[0].sku }}
Quantity: Decrease by {{ $node["Webhook"].json.body.line_items[0].quantity }}
Output: Shopify stock updated.
Update Amazon Node: HTTP Request
Node: HTTP Request
Settings:
URL: Amazon SP-API endpoint for inventory
Method: PUT
Authentication: Amazon API credentials
Body: { "sku": "{{ $node["Webhook"].json.body.line_items[0].sku }}", "quantity": "-{{ $node["Webhook"].json.body.line_items[0].quantity }}" }
Output: Amazon stock synced.
Log Node: Google Sheets
Node: Google Sheets
Settings:
Operation: Update
Spreadsheet ID: Inventory sheet
Range: A:C
Key: SKU column
Value: New quantity
Output: Centralized stock log.
Workflow Summary
- Flow: Webhook (sale) → Shopify (update) → HTTP Request (Amazon) → Google Sheets (log).
- Execution: Real-time, ~15 seconds.
Benefits
- Prevents overselling across channels.
- Saves hours of manual sync time.
- Maintains a unified inventory view.
Troubleshooting
- API Errors: Check Shopify/Amazon credentials.
- Sheets Mismatch: Verify column mappings.
Ready to transform your business with our technology solutions? Contact Us today to Leverage Our AI/ML Expertise.
Comment