National Commerce Docs
n8n flows

Backfill Missing Product SKUs

A manual maintenance flow that repairs shipment line items with a null Product SKU by re-fetching them from ShipHero.

A one-off maintenance utility. It repairs Shipment Line Items rows with a null product_sku by re-fetching the line item from ShipHero and linking it to the correct Product SKU record.

At a glance

  • Status: Inactive, run by hand.
  • Trigger: Manual only ("When clicking 'Test workflow'").
  • Runs on: Shipment Line Items where product_sku is null.
  • Talks to: ShipHero GraphQL (per-brand token) and Supabase.

How it works

  1. Get Line Items Without Products pulls all Shipment Line Items where product_sku is null.
  2. It loops in batches; Find Any Line Item Similarities fetches rows sharing the same Line_Item_Id, and a filter keeps only single-match cases.
  3. It resolves brand, then shipment, then order to obtain the order number and ShipHero token.
  4. It calls ShipHero GraphQL for the order and its shipments, splits out the line-item edges, and filters for the matching legacy_id.
  5. Get The Product For Line Item looks up Product SKUs by SKU, then Link Line Item With A Product updates the row's product_sku.

Notes

  • It deliberately skips line items with duplicate Line_Item_Id values. Those need manual resolution.
  • No automated trigger; run it by hand after the shipment pulls leave gaps.

On this page