Skip to main content

Re-link Open Lines to Mapped Product

POST 

/api/configurable-products/:id/relink-open-lines

Move open order lines that were booked to the base product (for example, before the configured SKU was mapped) onto the mapped product.

Required scope: products:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token (scopes products:write and orders:write; the caller also needs permission to update sales orders).

Only open lines with units still to ship are considered (fully shipped lines are history), and only untouched lines move: no fulfillment, manufacturing order or inventory movements, no warehouse split, no cancelled, returned, externally fulfilled or channel-shipped-unmapped units, no sales credit or decoration details, no other fulfillment on the order still waiting at its 3PL or shipping provider, no open dropship purchase order on the order (or a line the move could route to a dropship supplier), not billed on an issued or voided invoice. The rest are returned in blocked and stay on the base product. Lines on closed or cancelled orders are never touched.

The moved line keeps the tax the channel charged and its own line discounts (for example a discount code split onto the line), so the order total, discount, tax and balance due don't change. If moving a line would change any of them, or the order's saved tax already disagrees with its lines, it is not moved and is returned in blocked.

Response: relinked_lines / moved (count), eligible (the lines that moved), blocked and failed (lines whose move raised an error; each is rolled back on its own and carries code move_failed). Run it again to retry the leftovers.

Blocked lines stay on the base product and carry relinkable: false, blocked: {code, reason, fix}, and the same values flat as blocked_code, blocked_reason and blocked_fix (blocked is null on a line that can move). reason is a plain sentence to show a person; code is stable for your own handling; fix is what can be offered: repair_totals (Resync Sales Order Totals can put the order's saved tax back in step, then retry), open_order (it has to be sorted out on the sales order itself) or null (nothing safe to offer).

Codes:

  • shipped — "Already picked or fulfilled"
  • manufacturing_order — "Has a manufacturing order"
  • stock_allocated — "Stock already allocated or moved"
  • split — "Is split across warehouses"
  • cancelled_or_returned — "Has cancelled, returned or externally fulfilled units"
  • shipped_on_channel — "Shipped by the channel before it was mapped"
  • credit — "Has a sales credit"
  • invoiced — "Billed on an issued or voided invoice"
  • decorations — "Has decoration details"
  • fulfillment_at_provider — "Order has a fulfillment waiting at its provider"
  • dropship — "Order has a dropship purchase order"
  • stale_tax — "Order totals are out of date"; fix is repair_totals when that repair is safe for the order, otherwise null.
  • move_refused — the move itself was refused, with the reason (for example it would change the order's total, discount or tax, or "This line changed while it was being moved."); fix is open_order.
  • move_failed — the move raised an error and was rolled back; reason starts "Could not be moved:" and fix is null. Run the re-link again to retry.

Returns 422 when the configured SKU is not mapped or its product is archived; 404 when the configured SKU does not exist or line options are switched off.

A configured SKU that uses its base product (status uses_base) has nothing to move: the response is 200 with every list empty.

Request​

Responses​

OK

Response Headers
    Content-Type