Add a line to the cart (merges into an existing line of the item)
POST/carts/:cartId/lines
AddLine. One line per item: adding an item already in the cart merges quantities; nothing is ever rejected as a duplicate. Clears the current delivery quote and selections. Publishes CartLineAdded (analytics).
Request
Responses
- 200
- 400
- 404
- 409
- 422
- 500
The updated cart.
Response Headers
"true" when the answer is the stored response of an earlier request with the same Idempotency-Key (a 2xx, or a refusal that is final for the request; a retryable refusal and a 5xx are never stored - the key is released); absent on the first execution.
idempotency-key-required (no Idempotency-Key header), idempotency-key-invalid (not 1 to 128 printable ASCII characters) or malformed-request (not JSON, an unknown field, a NUL character or a body over 64 KiB).
not-found (no such cart or line, or an identifier over 128 characters; on a write it is not stored - the key is released and the same Idempotency-Key runs again, a cart or line can appear later) or resource-not-found (a NUL character in the path).
cart-closed (ErrCartClosed; stored and replayed - a closed cart never changes) or concurrent-update (not stored; the key is released and the same Idempotency-Key runs again). Or idempotency-key-reused (the Idempotency-Key was already used with a different request).
validation-failed or quantity-out-of-range (ErrQuantityOutOfRange; both stored and replayed - the request alone decides) or too-many-lines (ErrTooManyLines) or item-not-purchasable (ErrItemNotPurchasable; neither stored - the line count and the purchasability view can change, the key is released and the same Idempotency-Key runs again).
internal-error (an unexpected failure; the detail never carries the internal message).