Automation Blog

Daily insights into automation, AI, and the future of work.

Cut Stockouts with n8n: Auto PO Creation from ERP/Shopify

Detect low inventory in ERP or Shopify, create POs via NetSuite/API, send to suppliers and track acknowledgments and deliveries in Google Sheets.

The procurement problem and before scenario

Many operations teams still rely on manual inventory checks, email POs, and spreadsheets to manage procurement. That leads to late reorders, stockouts, duplicated orders, and long lead times because people must manually aggregate ERP or Shopify inventory, decide what to reorder, and then manually generate POs in NetSuite or via an API.

Before automation a typical workflow looks like: daily or weekly downloads from ERP/Shopify, manual threshold checks in Excel, copy/paste PO creation into NetSuite or an email to supplier, and updating a tracker. This consumes hours per week, introduces data entry errors, and lacks timely visibility into acknowledgments and ship dates.

Solution overview and architecture using n8n

The solution uses n8n as the orchestration layer to detect low inventory, generate purchase orders through NetSuite or a vendor API, forward orders to suppliers, and maintain a live tracking sheet in Google Sheets. Inputs come from either webhook events (Shopify inventory_webhook) or scheduled polling of an ERP API. n8n evaluates reorder thresholds, deduplicates items, and maps SKU-level data into the PO structure required by NetSuite or a supplier endpoint.

Key components are: Trigger nodes (Shopify webhook or Cron for ERP polling), HTTP Request or native connectors for NetSuite/API PO creation, conditional nodes for business rules (minimum order qty, lead times), Email/HTTP nodes to send POs to suppliers, and Google Sheets nodes to record POs, acknowledgments, and delivery updates. Error handling, retries, and idempotency keys prevent duplicate orders.

n8n workflow implementation details

Start with a trigger: use Shopify webhooks for immediate low-stock events or a Cron node to poll ERP inventory endpoints at business-friendly intervals. Parse the payload, normalize SKU and location fields, then run a Function node to apply reorder logic (safety stock, forecasted demand, min/max levels). Produce a compact reorder list and pass it to a SplitInBatches node when necessary to handle large catalogs.

For PO creation, use an HTTP Request node to call NetSuite REST/SuiteTalk (or the supplier's API). Authenticate via OAuth or API key, map SKU, quantity, cost center, and expected delivery into the API payload, and include an idempotency header using a generated PO reference to avoid duplicates. After a successful response, write the PO number, items, and ETA into Google Sheets using the Google Sheets node so procurement and operations teams have a single source of truth.

Supplier communication and acknowledgment tracking

Once the PO is created, n8n can send the order to suppliers via API, email (SMTP), or an EDI gateway. Include the PO reference and standardized line items. Configure a monitoring branch that listens for supplier acknowledgments: this can be a webhook endpoint that suppliers call, an email parser (IMAP node + parsing logic), or periodic polling of a supplier portal API. On acknowledgment, update the PO row in Google Sheets with status, confirmed quantities, and promised ship dates.

Delivery updates flow back into the same Google Sheet. Use carrier APIs or supplier confirmations to capture tracking numbers and estimated delivery dates. A subsequent n8n workflow can monitor delivery status changes and trigger alerts for exceptions (partial shipments, delays), allowing operations to proactively reallocate inventory or expedite critical items.

Business benefits, ROI and after scenario

After implementation the business sees measurable improvements: fewer stockouts, faster PO turnaround, fewer manual hours spent on procurement, and improved supplier communication. Typical gains include a 30–70% reduction in manual procurement time and a decrease in stockouts by 50% or more depending on prior practices. Accuracy improves because mapping and idempotency reduce duplicate or incorrect orders.

For ROI, calculate savings from labor reduction and avoided lost sales. Example: if procurement spends 8 hours/week on manual ordering at $30/hr, automation saving 6 hours/week equals $9,360/year. Combine that with incremental sales recovered from reduced stockouts and lower expedited shipping costs for late replenishment and you quickly offset development and integration costs. The workflow is modular and extensible, so updates to thresholds or suppliers are low-cost changes in n8n.

Need help with design or integration?

Visit my main website where you can learn more about my services.

As an experienced n8n automation consultant, I can create custom workflows tailored to your business needs, ensuring a scalable and future-proof solution. Let’s automate your lead process and unlock growth potential together.

Request a free consultation where I will show you what automation solutions I have that can make your operations more efficient, reduce costs, and increase your efficiency.

You might also find these posts interesting: