DeliveryGroup returns empty array after running a mutation on the cart

DeliveryGroup returns empty array after running a mutation on the cart

AisenA
Shopify Partner
2 0 0

Hi there! This post is related to Shopify Hydrogen on a development store. I would like to inquire if a certain behaviour regarding deliveryGroups is intentional or a bug.

I'm working on setting the delivery method of a cart after the delivery group has been created. I found that any attempts to modify the cart deletes the delivery group. This delivery group returns unmodified upon re-entering the checkout.

I've followed this method for setting the delivery option: https://shopify.dev/docs/custom-storefronts/hydrogen/cart/selected-delivery-options and experimented with this mutation from the storefront API: https://shopify.dev/docs/api/storefront/2024-01/mutations/cartSelectedDeliveryOptionsUpdate 

 

The mutation supposedly works when tested in the graphiql page, but still returns a cart with an empty array for deliveryGroups (even when it had prior). When the delivery group returns via visiting the checkout page, it is unmodified and it its state prior to editing. This behaviour not only occurs via modifying the deliveryOption, it also occurs when any change to the cart happens (increasing quantity of a product, changing attributes of a cart). 

 

Below are attached screenshots showcasing the mutations being run on the cart in attempt to modify the delivery option

image.pngimage.pngimage.png

Replies 2 (2)

AnshumanPanda
Shopify Partner
4 0 0

Did you find any answer to it?

AisenA
Shopify Partner
2 0 0

Nope, In the end I opted to change the flow and let the user set it in the checkout page. I limited options using an app and gave up on doing it this way.