Skip to main content
Version: v1.0.0(int)

W080: Delete SKU

Removes a SKU if nothing references it anywhere. Triggered from SKU Detail. The in-use check is broad: PO items, WO items, SO items, BOMs (as output or input SKU), and the FG ledger all block deletion.

Steps

  1. Load the SKU. Call Products.getSkuById.

  2. Run in-use checks across every domain that references SKUs. PO items via PurchaseOrders.listAllItems({ skuId }), WO items, SO items, BOM as output SKU or input SKU, and FG ledger entries.

  3. Refuse if any reference exists. Return the affected domain counts in the error payload.

  4. Delete the SKU. Call Products.deleteSku.

Returns

Nothing.

Business rules

  • Hard delete is rare. Archive (via PATCH isActive=false, W079) is the routine path; hard delete is reserved for SKUs that exist by mistake and never moved.

Errors

  • NotFoundError. The SKU was not found.
  • InUseError. The SKU is referenced by one or more downstream domains.