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

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

Needs changes

by Kumar SmartFlow Craft ✓ · 98 views · created 2026-03-18 · CRM, AI Summarization

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 10 nodes and runs on a schedule (cron 0 6 * * *). Along the way it connects Shopify, OpenAI Chat Model, Gmail and Google Sheets.

How it runs

Trigger: On a schedule (cron 0 6 * * *).

  1. Fetch All Products (Shopify): get many (product)
  2. Fetch Recent Orders (Shopify): get many
  3. Compute Sales Velocity (Code): runs custom JavaScript code
  4. Predict Stockout Risk (AI Agent): runs an AI agent, with model: OpenAI — Predict; output parser: Stockout Risk Schema
  5. Should Reorder? (If): checks a condition and branches into true / false
  6. Send Reorder Email (Gmail): uses Gmail
  7. Log to Google Sheets (Google Sheets): append or update

Services it uses

ShopifyOpenAI Chat ModelGmailGoogle Sheets

Before you upgrade to n8n 3.0

1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:

  • AI Agent v1 (old agent modes) in Predict Stockout Risk (v1.8): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).

Removed in 3.0Replace with
AI Agent v1 (old agent modes)
Predict Stockout Risk (v1.8)
Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Nodes used (9)

From the author

🚀 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…

Excerpt from Kumar SmartFlow Craft's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.