Skip to main content

Replace Channel-Linked Sales Order Lines

POST 

/api/v2/sales-orders/:salesOrder/channel-mappings/replace

Swaps the order lines linked to one sales channel line for another line of the same order, e.g. the bundle components a channel item was split into, replaced by the kit product that ships. The replacement line is linked to the channel line and keeps that link through channel re-syncs. Each replaced line is deleted, or, when a shipping provider has a record of it (a fulfillment order for it was submitted to, or voided at, a carrier), every remaining unit is cancelled and the line drops to a zero price, so it stays as history without counting toward the order total.

Required scope: orders:write

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

Authentication: Requires Bearer token.

Request Body:

  • sales_channel_line_id (required, string): The marketplace order item ID the lines are linked to
  • line_id (required, integer): The order line that replaces them (must belong to this order)
  • replaced_line_ids (required, array of integers, min 1): Order lines currently linked to sales_channel_line_id; must belong to this order and must not include line_id

Errors:

  • 409 when a replaced line has shipped units or is committed to a live fulfillment (cancel or void the fulfillment first)
  • 422 when a line does not belong to this order or a replaced line is not linked to sales_channel_line_id

Request​

Responses​

OK

Response Headers
    Content-Type