National Commerce Docs
n8n flows

Update On-Hand Inventory Counts

Keeps Supabase inventory in sync with real-time available quantities from ShipHero, per warehouse and base SKU.

This flow keeps Supabase Inventory Units_Remaining_in_Stock in sync with real-time available quantities from ShipHero, per warehouse and Base SKU.

At a glance

  • Status: Active.
  • Trigger: Schedule (every 30 min), a WeWeb sign-in webhook, a "draft PO replen finished" webhook, an Execute Workflow call from Purchase Order Update Handler, and a manual Test trigger.
  • Runs on: Every warehouse and its inventory rows.
  • Talks to: ShipHero GraphQL (per-brand token), Supabase, and WeWeb.

How it works

  1. It loads all warehouses, all base SKUs, and all brands into memory for lookup.
  2. It loops warehouses; for each, Get Inventory Records For Warehouse fetches its Inventory rows.
  3. Prepare Inventory Array filters out rows with a null base_sku_id and enriches each with its _inventory_sku and _shiphero_access_token from the in-memory maps.
  4. It loops inventory rows; Get Base SKU On-Hand QTY In Warehouse calls ShipHero GraphQL warehouse_products(sku, warehouse_id) with the brand token.
  5. Update Available Quantity For Inventory writes ShipHero's available value to Units_Remaining_in_Stock.

Notes

  • Per-row Supabase lookups are disabled in favor of the in-memory enrichment map for performance.
  • It writes ShipHero's available field, not the raw on_hand value.

On this page