What this workflow does
- Daily at 6am (Schedule Trigger) starts the run.
- Shopify stock levels (HTTP Request, GraphQL Admin API) reads on-hand, committed and incoming quantities for each tracked variant across up to three locations.
- Shopify orders yesterday (HTTP Request) reads yesterday’s orders, excluding cancellations, to count units sold per SKU.
- Read supplier table and Read snapshot history (Google Sheets) load lead time, safety days, case pack and minimum order per SKU, and the daily history.
- Build daily snapshot (Code) combines stock and sales into one row per SKU and stops with a clear error if Shopify returned errors.
- Save snapshot (Google Sheets) appends today’s rows. Velocity needs this history, so turn the workflow on before you rely on alerts.
- Reorder math (Code) calculates average daily units over 28 days, leaving out stockout days, then reorder point (velocity times lead time plus safety days) and inventory position (on hand plus incoming plus on order minus committed). It suggests a quantity rounded up to case pack and minimum order, and flags short history, doubled velocity and stockouts.
- Explain flags with Claude (HTTP Request) returns strict JSON notes for flagged lines only. It never sees an instruction to change a quantity, and its output is never used as a number.
- Build digest (Code) groups lines by supplier, sorts by days of cover, shows the math on each line, and falls back to plain flags if the AI call fails.
- Exception? (If) posts the digest to purchasing and any AI failure to the exceptions channel.
Before you import
- A current n8n version.
- A Shopify custom app with
read_products,read_inventoryandread_orders, and an Admin API access token. Custom apps created in the Shopify admin before January 1, 2026 show a static 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. - A Google Sheet, an Anthropic API key and a Slack bot in two channels.
Setup
- Import the JSON and connect the Shopify, Google Sheets, Anthropic and Slack credentials.
- Create a
Supplierstab with headers: sku, supplier, lead_time_days, safety_days, case_pack, min_order_qty, on_order_qty. - Create a
Snapshotstab with headers: date, sku, name, on_hand, committed, incoming, units_sold. - Replace
REPLACE_WITH_SHOP(two nodes),REPLACE_WITH_SHEET_ID(three nodes),REPLACE_WITH_SLACK_PURCHASING_CHANNEL_IDandREPLACE_WITH_SLACK_EXCEPTIONS_CHANNEL_ID. - Adjust
WINDOW_DAYSandREVIEW_DAYSin Reorder math. - The Shopify URLs use API version
2026-10, which Shopify supports until October 2027. Each version is supported for at least 12 months, so bump the version in both URLs about once a year.
Test it
Add two SKUs to the supplier table and paste a week of made-up snapshot rows for one of them with steady sales. Run the workflow manually. The SKU with low position should appear in Slack with its math. Set its lead time and safety days to zero and run again to watch it drop off.
Make it production-ready
- This starter reads 100 variants and 80 orders. Add GraphQL pagination or Shopify bulk operations for bigger catalogs, and watch for the truncation warning in the digest.
- Move snapshots to Postgres once history passes a few thousand rows per month.
- Track actual lead times from receipt dates and use a rolling average instead of the supplier’s quote.
- Add Slack approve buttons and draft purchase orders per supplier, as the guide describes.
- Set an n8n error workflow so a failed Shopify query is noticed the same morning.
Read the full guide on AI inventory reorder alerts for safety stock and bundle handling, or talk to Lumeor about QuickBooks Online purchase orders or a warehouse system.