Set an item quantity

Sets the ABSOLUTE quantity (1 or more) of one variant's line in the caller's cart and recomputes the totals. Removing an item is the DELETE route, not quantity zero. The captured unit price is untouched: this changes how many, never at what price. The cart SELF-HEALS first (Phase 5): a line whose variant has stopped being sellable is auto-removed before the update applies. When the pruned row still carries the requested variant id (for example, its product was unpublished), PATCH returns the healed cart with `removedLines`, not a bare 404. A hard-deleted row cannot do so: `ON DELETE SET NULL` erased that correlation before this request, so the heal and total recompute persist but PATCH returns the uniform 404 with no report body. A variant NEVER in the cart, having no cart, and raising a quantity while the site's product-variants surface is switched off all return that identical 404: the line routes never become a probe for whether a cart token resolves. > **Note:** This endpoint requires the e-commerce feature to be enabled on your site.

PATCH/cart/lines
Base URLhttps://api.lynkow.com/storefront/{siteId}

Request body
required

  • quantity
    integer
    required

    Required. Between 1 and 999

  • variantId
    string
    required

    Required. Product variant identifier (var_ prefixed id)

Feedback

Was this page helpful?