Skip to content

Update Cart Item

About

The updateCartItem mutation modifies the quantity or options of an existing cart item. Use this mutation to:

  • Update product quantities in the shopping cart
  • Adjust cart items from the cart page
  • Modify product options or variants after adding
  • Handle quantity increase/decrease operations
  • Validate inventory availability for new quantities
  • Recalculate cart totals and discounts

This mutation validates the new quantity against available inventory and updates cart totals including any applicable discounts and taxes.

Quantity Update Not Supported for All Product Types

Event booking and appointment booking products do not support quantity updates after being added to the cart. These products have fixed quantities tied to their booking configuration — event bookings have ticket quantities set during add-to-cart, and appointment bookings are always for a single slot. You can identify these items by checking the canChangeQty field on the cart item, which will be false for these product types. To change the quantity, the customer must remove the item and re-add it with the desired configuration.

Arguments

ArgumentTypeDescription
cartItemIdInt!The numeric ID of the cart item to update.
quantityInt!The new quantity to set for the cart item.

How to get cartItemId: This is the id field returned on each cart item from the Add to Cart or Get Cart response, available under items.edges[].node.id.

Authentication

This mutation supports both authenticated customers and guest users:

  • Authenticated customers: Provide a valid customer authentication token in the Authorization header. Obtain this token via the Customer Login API.
  • Guest users: Provide the Guest Cart Token cartToken obtained from the Create Cart mutation.
Authorization: Bearer <accessToken>

Possible Returns

FieldTypeDescription
createUpdateCartItemCart!Updated cart with modified item.
updateCartItemCartItem!The updated cart.
messageString!Success or error message.
successBoolean!Indicates successful update.
errors[ErrorMessage!]Validation errors if quantity unavailable.

Released under the MIT License.