Skip to main content
POST
Update Cart

Update Cart

Updates quantities of items in the cart, or updates the cart note, attributes, and discount codes.
Cart update is a storefront surface, not part of the OAuth /api/v1 app API. It follows the AJAX cart contract: requests are made against the storefront origin (your store domain), identity is the cart cookie token (not a Bearer access token), and the response is the flat cart object — not wrapped in a { status, type, data } envelope.

Request

Body Parameters

object | array
Either an object mapping variant ids or line item keys to new quantities (a variant id not yet in the cart is added), or an array of quantities by line position ([1, 0, 3] sets line 1 to 1, removes line 2, sets line 3 to 3). Quantities must be whole numbers >= 0; 0 removes the line. Every quantity is checked first — a negative or fractional one returns 422 and nothing changes.
string
Update the cart note
object
Cart attributes to set. Merged into the existing attributes (as on Shopify); set a key to "" or null to remove it.
string
Discount code(s) to apply. Accepts a single code or comma-separated codes. Pass an empty string to clear all applied discount codes.

Response

The response is the flat cart object (the same shape returned by Get Cart), reflecting the updated cart. For quantity updates the response also includes an items_changelog object ({ added, removed }).

Example Response

Updating Cart Note, Attributes, and Discounts

Errors

On failure the endpoint returns a standard error body with the real HTTP status: