Back to Templates

Predict Shopify stockouts with GPT-4o and email suppliers via Gmail

Last update

Last update a month ago

Share


๐Ÿš€ How it works

Runs daily at 06:00 UTC, pulls every Shopify product variant's stock level,
calculates real sales velocity from the last 7 days of orders, then uses
GPT-4o to predict stockout dates and decide whether to reorder โ€” automatically.

  • ๐Ÿ›๏ธ Fetches all Shopify product variants and current inventory quantities
  • ๐Ÿ“ฆ Pulls the last 7 days of orders and computes units sold per variant
  • โšก Calculates sales velocity (units/day) and estimated days until stockout
  • ๐Ÿค– AI Agent classifies risk: critical / high / medium / low and recommends reorder quantity (30-day demand + 20% safety buffer)
  • ๐Ÿ“ง Sends a formatted reorder request email to your supplier for high-risk variants
  • ๐Ÿ“Š Logs every decision (reordered or skipped) to Google Sheets for inventory tracking

๐Ÿ› ๏ธ Set up steps

Estimated setup time: ~15 minutes

  1. Shopify โ€” create a Custom App in your Shopify Admin โ†’ Apps โ†’ Develop Apps; enable read_products and read_orders scopes; copy the Admin API Access Token
  2. OpenAI โ€” connect your OpenAI API credential (GPT-4o)
  3. Gmail โ€” connect Gmail OAuth2; replace [email protected] with your real supplier address
  4. Google Sheets โ€” connect Google Sheets OAuth2; replace YOUR_REORDER_LOG_SHEET_ID with your sheet ID; create a sheet tab named Reorder Log
  5. Follow the sticky notes inside the workflow for per-node guidance

๐Ÿ“‹ Prerequisites

  • Shopify store (any plan with Admin API access)
  • OpenAI API key
  • Gmail account for supplier notifications
  • Google Sheets for reorder log

Custom Workflow Request with Personal Dashboard

[email protected]

https://www.smartflowcraft.com/contact

More free templates

https://www.smartflowcraft.com/n8n-templates