API overview
Change a cart line quantity
Choose an operation to see its request, response shape, access rules and implementation source.
WritePublic cart context
PATCH/api/v1/cart/{lineKey}
Change a cart line quantity
No auth:sanctum or bearer ability is required by this route.
Request
| Field | In | Rule |
|---|---|---|
lineKey | Path parameter | Required line_key returned by the cart, not product_id. Unknown keys do not imply a 404. |
X-Cart-Token | Header | Guest cart credential returned by the cart API. Preserve it; a missing or malformed token starts a new cart context. |
quantity | JSON body | Required integer, 0 to 99. Zero removes the line. |
curl --request PATCH "https://shop.example.test/api/v1/cart/$LINE_KEY" \
--header 'Accept: application/json' \
--header "X-Cart-Token: $CART_TOKEN" \
--header 'Content-Type: application/json' \
--data '{"quantity":2}'Response200
Success: 200
Response shape (notation, not a captured response)
{ data: { token: string, item_count: integer, requires_shipping: boolean, subtotal_amount: integer|null, currency: string|null, lines: CartLine[] } }Response header: X-Cart-Token matches data.token.
Common errors
| HTTP status | Meaning |
|---|---|
422 | validation_error: invalid input or unmet domain requirements. Payment initiation can also return payment_failed. |
429 | rate_limited: back off before retrying, especially writes. |