Skip to content

Update Cart Item

Update the quantity or attributes of an item in the shopping cart.

Endpoint

PUT /api/shop/cart/items/{itemId}

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key

Path Parameters

ParameterTypeRequiredDescription
itemIdintegerYesCart item ID

Request Body

json
{
  "quantity": 5,
  "attributes": {
    "color": "Red",
    "size": "Medium"
  }
}
FieldTypeRequiredDescription
quantityintegerNoNew quantity
attributesobjectNoUpdated attributes

Response Fields (200 OK)

FieldTypeDescription
idintegerCart item ID
productIdintegerProduct ID
productNamestringProduct name
quantityintegerUpdated quantity
pricedecimalUnit price
subtotaldecimalUpdated line total
attributesobjectUpdated attributes

Response Metadata

FieldTypeDescription
messagestringSuccess message
cartTotaldecimalUpdated cart total

Validation

  • Quantity must be at least 1
  • Quantity cannot exceed available stock
  • Attributes must be valid for the product

Use Cases

  • Change quantity in cart view
  • Update product variations (size, color)
  • Modify options before checkout
  • Adjust selections on cart page

Released under the MIT License.