commercetools icon

commercetools

Interact with the commercetools API. Operations are auto-generated from the official Postman collection.

Actions671

Cart → Update Cart by Key

AI-generated

Summary

Update a cart in commercetools by specifying its unique cart key and version, applying one or more update actions to modify the cart's state.

Inputs

  • Cart Key (required) — The unique key identifying the cart to update.
  • Version (required) — The current version number of the cart, used for concurrency control.
  • Actions (JSON) — A JSON array of update actions to apply to the cart; if provided, it overrides the UI-based actions.
  • Actions (UI) — One or multiple update actions selected and configured via the UI, each specifying a cart modification such as adding line items, setting shipping address, changing quantities, and many more.

Output shape

a single JSON object representing the updated cart.

Requires providing the current version of the cart for optimistic concurrency control. Actions can be specified either as raw JSON or through the UI; if raw JSON is set and not empty, it overrides the UI actions.

Examples

Example 1: Update a cart by its key to add a new line item and change the shipping address by setting corresponding actions either through the UI or by raw JSON input, supplying the required version for the update to succeed.

Set 'Cart Key' to the cart's unique key, provide the current 'Version', and add desired update actions in 'Actions (UI)' or 'Actions (JSON)' fields.

Links

Discussion