Skip to main content

cartRemoveItem

Overview

Call removeCartItem with the ID of the line item to delete. The response mirrors the cart structure so you can refresh totals, coupons, and UI state immediately.

Mutation

mutation RemoveCartItem($data: RemoveCartItemInput!) {
removeCartItem(data: $data) {
data {
_id
app
account {
_id
verified
blocked
orderCount
lastSeen
createdAt
updatedAt
}
coupon
kind
couponApplied
couponDiscount
items {
_id
productId
variantId
productData { title slug app image { _id fileUrl } price }
variantData {
price
compareAtPrice
options {
_id
option { _id name type product }
label
sortOrder
}
}
quantity
price
compareAtPrice
totalPrice
totalCompareAtPrice
totalSavings
}
deviceId
sessionId
status
totalQuantity
totalPrice
totalCompareAtPrice
totalSavings
isFastOrder
createdAt
updatedAt
url
encryptionKey
}
success
message
}
}

Variables

{
"data": {
"itemId": "<CART_ITEM_ID>"
}
}

Examples

curl -X POST \
https://appssubdomain.com\
-H "Content-Type": "application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "mutation RemoveCartItem($data: RemoveCartItemInput!) { removeCartItem(data: $data) { success message data { _id totalPrice items { _id quantity } } } }",
"variables": {
"data": {
"itemId": "<CART_ITEM_ID>"
}
}
}
EOF

Notes

  • Use the returned cart snapshot to update UI and detect whether coupon totals changed after removal.
  • Validate itemId belongs to the current session/account before calling, otherwise expect an error in message.