How to delete assigned shippingRateHandle via checkoutShippingLineUpdate?

kinokritik
Tourist
6 0 12

We need to find a way how to set previously assigned checkout shippingRateHandle to blank. We struggle to do it via checkoutShippingLineUpdate mutation in Storefront API

Here is the scenario which leads to that
Our store has a combination of products which require shipping and digital products which don't require shipping

1. Customer adds items which require shipping to cart. For which we create a new checkout via storefront and set items via checkoutLineItemsAdd

2. Customer sets his shippingAddress, which we save via checkoutShippingAddressUpdateV2 

3. After that we get availableShippingRates and assign one via checkoutShippingLineUpdate 

4. At this point in journey, customer decides that he wants to change items. She goes back and change items. Removes those which require shipping and leaves only digital. We update it via checkoutLineItemsReplace 

5. Surprisingly when items requiring shipping are removed, shippingLineItem is still assigned to checkout. So here is where we need to find a way how to blank previously assigned shippingRateHandle/shippingLineItem. 

 

We are trying the following options to pass to mutation checkoutShippingLineUpdate

1. "shippingRateHandle": "" - empty string. Which gets en error

 

{
    "errors": [
        {
            "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 8699873e-a700-4841-b7e9-a2fa12a83c71 (include this in support requests)."
        }
    ]
}

 

 

2. If we try to assign anything else to "shippingRateHandle" it gets error

 

 "checkoutUserErrors": [
                {
                    "code": "PRESENT",
                    "field": [
                        "shippingRateHandle"
                    ],
                    "message": "Shipping rate must be blank"
                }
            ]

 

 

Hence my question

What is the right way to remove assigned shippingRateHandle from a checkout or assign it to blank?

 

Replies 4 (4)

kinokritik
Tourist
6 0 12

As there was no update on this thread I've reached out to Shopify Support

After spending an hour in waiting line for live chat, support specialist said that they can't help with API related questions and that he would forward my request to development team which would answer within 48 hours....

48 hours later I've got a reply that Shopify development team won't be able to assists as they consider it to be a Theme specific issue and they don't support themes per policy Support for themes

 

Well, my dear Shopify developers, that is not a theme issue, but a Storefront API bug, which keeps attached shippingRate to a checkout items of which don't require shipping. Or if that is allowed by design, that is omitted in Storefront API documentation how to remove shippingRate from checkout...

beerlington
Visitor
1 0 0

Did you find a workaround for this issue @kinokritik ?

kinokritik
Tourist
6 0 12

Our workaround was to create a new checkout and add items there 

viico
Shopify Partner
4 0 0

We are facing this exact problem here. This is clearly a bug in the frontend API