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.
Authentication
This mutation supports both authenticated customers and guest users:
- Authenticated customers: Provide a valid customer authentication token in the
Authorizationheader. Obtain this token via the Customer Login API. - Guest users: Provide the Guest Cart Token
cartTokenobtained from the Create Cart mutation.
Authorization: Bearer <accessToken>Possible Returns
| Field | Type | Description |
|---|---|---|
createUpdateCartItem | Cart! | Updated cart with modified item. |
updateCartItem | CartItem! | The updated cart. |
message | String! | Success or error message. |
success | Boolean! | Indicates successful update. |
errors | [ErrorMessage!] | Validation errors if quantity unavailable. |

