Skip to main content

Update cart item quantity

Change the quantity of an existing line item in the cart.

Mutation

mutation UpdateCartItem($cartId: String!, $itemId: String!, $quantity: Int!) {
cartUpdateItem(
id: $cartId
itemId: $itemId
input: { quantity: $quantity }
) {
items {
itemId
productId
quantity
price
priceNet
totalPrice
totalPriceNet
}
total {
subTotal
totalGross
totalNet
}
}
}

Variables

{
"cartId": "019c77b7-565f-7ea0-8660-42bc63a7f728",
"itemId": "019c77b7-72a0-75fe-8a20-b98927d76652",
"quantity": 5
}

Response

{
"data": {
"cartUpdateItem": {
"items": [
{
"itemId": "019c77b7-72a0-75fe-8a20-b98927d76652",
"productId": 25,
"quantity": 5,
"price": 1595.04,
"priceNet": 1929.99,
"totalPrice": 7975.20,
"totalPriceNet": 9649.99
}
],
"total": {
"subTotal": 7975.20,
"totalGross": 8310.20,
"totalNet": 10055.34
}
}
}
}

How it works

The itemId is a top-level argument, not part of the input object. Setting quantity to 0 does not remove the item — use cartDeleteItem for that. The response returns the full updated cart so you can refresh totals in one round trip. Products with minimumQuantity or purchaseUnit constraints will reject invalid quantities.

See also