Remove Cart Item
About
The removeCartItem mutation deletes a product from a customer's shopping cart. Use this mutation to:
- Remove items from the cart page UI
- Delete products from mini cart displays
- Clear unwanted items from ongoing checkout
- Manage cart contents programmatically
- Restore inventory reservations
- Update cart totals and pricing
This mutation removes the line item completely, updates inventory, and recalculates cart totals, 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>Arguments
| Argument | Type | Description |
|---|---|---|
cartItemId | String! | Cart Item id. |
Possible Returns
| Field | Type | Description |
|---|---|---|
cart | Cart! | Updated cart after item removal. |
message | String! | Success or error message. |
success | Boolean! | Indicates successful removal. |
removedItem | CartItem! | The item that was removed. |
cart.items | [CartItem!]! | Remaining cart items. |
cart.itemsCount | Int! | Updated item count. |
cart.subTotal | Float! | Recalculated subtotal. |
cart.total | Float! | Recalculated grand total. |
errors | [ErrorMessage!] | Errors if removal failed. |

