How To Delete Product Quantity in Cart By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

The following below steps need to follow to update product Quantity in Cart by using GraphQL in Magento 2.x / Adobe Commerce 2.x

Use the updateCartItems mutation to update shopping cart items and removeItemFromCart to remove a product from the shopping cart.

Step [1] – Recommendation to use below syntax to delete product Quantity in Cart

Here Using Postman

Syntax –

Step [2] – Put below Request

mutation {
  removeItemFromCart(
    input: {
      cart_id: "s6Wgi4j0H2ULX0YHfD3mhOMHuAL10qLL"
      cart_item_id: 140
    }
  ) {
    cart {
      items {
        id
        quantity
        product {
          id
          sku
          name
        }
        prices {
          price{
            value
            currency
          }
        }
      }
    }
  }
}

Step [3] – Put below Output Response

{
    "data": {
        "removeItemFromCart": {
            "cart": {
                "items": []
            }
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *