Skip to main content

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

Workflow preview

Workflow preview
100%
Predict Shopify stockouts with GPT-4o and email suppliers via Gmail preview
Open on n8n.io

1. Workflow Overview

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...

Best for

  • CRM automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.scheduletrigger, n8n-nodes-base.shopify, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.if

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Kumar SmartFlow Craft.

Original n8n.io source

1.1 Workflow description

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

πŸš€ 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

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Prerequisites

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Setup Required

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - How It Works

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Daily Inventory Check

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 6 - Fetch Products note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Fetch All Products

Type / Role
n8n-nodes-base.shopify - shopify
Config choices
Version 1

Block 8 - Fetch Orders note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Fetch Recent Orders

Type / Role
n8n-nodes-base.shopify - shopify
Config choices
Version 1

Block 10 - Velocity note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Compute Sales Velocity

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Predict note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Predict Stockout Risk

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 14 - OpenAI β€” Predict

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 15 - Stockout Risk Schema

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 16 - Should Reorder note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Should Reorder?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 18 - Email note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Send Reorder Email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 20 - Log note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Log to Google Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

3. Summary Table

Workflow Predict Shopify stockouts with GPT-4o and email suppliers via Gmail
Complexity advanced
Nodes 21
Categories CRM, AI Summarization
Author Kumar SmartFlow Craft
Published 18 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14143/14143.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Predict Shopify stockouts with GPT-4o and email suppliers via Gmail do?

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...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your CRM, AI Summarization use case.