Skip to content

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 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>

Arguments

ArgumentTypeDescription
cartItemIdString!Cart Item id.

Possible Returns

FieldTypeDescription
cartCart!Updated cart after item removal.
messageString!Success or error message.
successBoolean!Indicates successful removal.
removedItemCartItem!The item that was removed.
cart.items[CartItem!]!Remaining cart items.
cart.itemsCountInt!Updated item count.
cart.subTotalFloat!Recalculated subtotal.
cart.totalFloat!Recalculated grand total.
errors[ErrorMessage!]Errors if removal failed.

Released under the MIT License.