Cannot remove bundled product using useApplyCartLinesChange in Checkout UI extension

I am trying to remove a bundled product in Checkout UI extension using applyCartLinesChange

const changeCartItem = useApplyCartLinesChange();

What I do is

changeCartItem({
  type: "removeCartLine",
  id: lineItem.id,
  quantity: lineItem.quantity,
});

It works fine for ordinary line items. However, when trying to remove bundle line item, it fails to remove it with the following error response:

{
    "type": "error",
    "message": "Server failed to fulfill the request and to identify the exact issue."
}

The bundled line item has the following body:

{
    "id": "gid://shopify/CartLine/ID",
    "quantity": 1,
    "cost": {
        "totalAmount": {
            "amount": 2235.46,
            "currencyCode": "USD"
        }
    },
    "merchandise": {
        "type": "variant",
        "id": "gid://shopify/ProductVariant/ID",
        "title": "The 3p Fulfilled Snowboard - 15% OFF",
        "image": {
            "url": "URL",
            "altText": ""
        },
        "selectedOptions": [
            {
                "name": "Title",
                "value": "Default Title"
            }
        ],
        "product": {
            "id": "gid://shopify/Product/ID",
            "vendor": "MY STORE",
            "productType": ""
        },
        "requiresShipping": true
    },
    "attributes": [],
    "discountAllocations": [],
    "lineComponents": [
        {
            "type": "bundle",
            "id": "gid://shopify/CartLineComponent/ID",
            "merchandise": {
                "type": "variant",
                "id": "gid://shopify/ProductVariant/ID",
                "title": "The 3p Fulfilled Snowboard",
                "image": {
                    "url": "URL",
                    "altText": ""
                },
                "selectedOptions": [
                    {
                        "name": "Title",
                        "value": "Default Title"
                    }
                ],
                "product": {
                    "id": "gid://shopify/Product/ID",
                    "vendor": "MY STORE",
                    "productType": ""
                },
                "requiresShipping": true
            },
            "quantity": 1,
            "cost": {
                "totalAmount": {
                    "amount": 2235.46,
                    "currencyCode": "USD"
                }
            },
            "attributes": []
        }
    ]
}

It was created using Expand operation in Cart Transform Extension to assign a discount.
But the issue is that Checkout UI cannot remove bundle products.

Shopify Team, can you please resolve this bug or suggest a solution for the issue.
Thanks

Hi Adkhamllama,

I haven’t seen issues with using the applyCartLinesChange method with bundles previously - is there an x-request_id value in the request header that’s failing, that we can use to look into this deeper?

@Liam , I cannot find the request in network tab. Maybe that is because of isolated sandbox that extension runs or request is done in a different way.
How can I find it?

1 Like

Hi Liam, we are currently having the same exact issue as reported above.

To reproduce the bug:

  1. create a cartTransform function that makes a product bundle using the grapQL MergeOperation.

  2. use the cartLinesUpdate or cartLinesRemove mutations in Storefront Cart API to try and remove the the cart line of the bundled product

  3. return error from Shopify

Can someone at Shopify attempt the above and confirm that they are able to remove or update a cart line of a bundled product?