Skip to content

WooCommerce Inventory Sync with n8n: Keep Stock Accurate

2026-02-26 · AutCode · , , ,

Automating WooCommerce inventory management using n8n workflow

When stock is managed in an ERP or warehouse system, WooCommerce is only a copy. The question is how that copy stays accurate. Get it wrong and you sell items you do not have, or hide items you do.

This guide explains how to sync inventory into WooCommerce with n8n: which system owns the number, how often to sync, and how to keep the process safe. We used the same approach, with polling plus a webhook fallback, in our B2B wholesale platform.

Decide who owns the stock number

Pick one source of truth. If the warehouse system owns stock, WooCommerce should only receive updates and should not push its own numbers back unless you handle reservations deliberately. Two systems both writing the same field is how stock drifts.

Two ways to get changes: polling and webhooks

  • Polling. A Schedule Trigger asks the warehouse API for changes every few minutes. Simple and robust, but not instant.
  • Webhooks. The warehouse calls n8n when a quantity changes. Fast, but you must handle missed or duplicated calls.

The dependable combination is both: frequent polling as the safety net and webhooks for critical changes. In our project stock was polled every 15 minutes, with a webhook fallback for important changes.

The workflow

  1. Get changes from the warehouse API with an HTTP Request node. Ask only for items changed since the last run, not the whole catalog.
  2. Match products. Use a stable identifier, normally the SKU, to find the WooCommerce product or variation. Do not match on names.
  3. Transform. Map the quantity and decide what a zero should do: mark out of stock, mark backordered, or hide the product.
  4. Update WooCommerce through the REST API. For many products, use the batch endpoint rather than one call per product.
  5. Log the result and keep a list of SKUs that could not be matched.

Keep it safe

  • Make updates idempotent. Setting stock to 12 twice is harmless. Adding 12 twice is not. Send absolute quantities, not increments.
  • Retry, do not lose data. If the store or the warehouse API is down, hold the changes and retry on the next run.
  • Limit the blast radius. Reject a run that would set a huge share of the catalog to zero. It is far more likely a bad feed than a real stockout.
  • Handle variations. Variable products keep stock per variation, so update the variation, not just the parent.

Reservations and orders in flight

Between an order being placed and the warehouse confirming it, the two systems disagree. Decide whether WooCommerce reduces stock at checkout (it normally does) and whether the warehouse number already includes open orders. Writing this down before building prevents double counting.

Testing

Run the workflow against a staging copy first. Compare a sample of SKUs between the two systems after each run for the first week. Mismatches usually point to a matching or unit problem, such as cases versus single items.

More on integrating stock and orders

Inventory is one part of the wider data flow between a store and its back office. See our guide to WooCommerce ERP integration data mapping, or the comparison of n8n and custom code for automation if you are choosing a tool. If you need a low-stock warning on top, read our low stock alerts guide.

Frequently asked questions

How often should stock sync run?

Every 5 to 15 minutes works for most stores. Add webhooks for items that sell out quickly.

Which identifier should I match on?

The SKU, as long as it is unique and stable in both systems.

What if the warehouse API is down?

Keep the pending changes and retry on the next run. Do not overwrite WooCommerce with empty data.

Can WooCommerce update the warehouse too?

Yes, but decide ownership first. Usually WooCommerce sends orders and the warehouse owns the stock quantity.

Need inventory sync built?

See our WooCommerce system integrations and n8n workflow automation services, or send us a brief.