I am using useDeliveryGroups() hook in checkout UI extension. It supposed to return the current delivery groups for the checkout when delivery address changes ( As i checked in hook implementation ).
Steps to reproduce the behavior:
Use the hook in the extension and print the return result.
Now at information page fill the shipping address and select any available shipping method on shipping page.
I am using useDeliveryGroups() hook in checkout UI extension. It supposed to return the current delivery groups for the checkout when delivery address changes ( As i checked in hook implementation ).
Steps to reproduce the behavior:
[ { "targetedCartLines": [ { "id": "gid://shopify/CartLine/6169802ba0c31361360e65a18d473b7c" }, { "id": "gid://shopify/CartLine/540bbb6f8e223a63103db789078c6180" } ], "deliveryOptions": [ { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-1841c728747429c89ca8980cc97b6e21", "title": "Click and Collect", "description": "Ships next day", "type": "shipping", "carrier": {}, "cost": { "amount": 0, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 0, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "Click and Collect" }, { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-945b4de19461d3c9fc765b115996e776", "title": "Standard", "type": "shipping", "carrier": {}, "cost": { "amount": 0, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 0, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "Standard" } ], "selectedDeliveryOption": { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-945b4de19461d3c9fc765b115996e776" }, "groupType": "oneTimePurchase", "isDeliveryRequired": true, "id": "gid://shopify/DeliveryGroup/269ea2856c41d63937d1ba5212c29713" } ]
[ { "targetedCartLines": [ { "id": "gid://shopify/CartLine/6169802ba0c31361360e65a18d473b7c" }, { "id": "gid://shopify/CartLine/540bbb6f8e223a63103db789078c6180" } ], "deliveryOptions": [ { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-1841c728747429c89ca8980cc97b6e21", "title": "Click and Collect", "description": "Ships next day", "type": "shipping", "carrier": {}, "cost": { "amount": 0, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 0, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "Click and Collect" }, { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-945b4de19461d3c9fc765b115996e776", "title": "Standard", "type": "shipping", "carrier": {}, "cost": { "amount": 0, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 0, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "Standard" } ], "selectedDeliveryOption": undefined, "groupType": "oneTimePurchase", "isDeliveryRequired": true, "id": "gid://shopify/DeliveryGroup/269ea2856c41d63937d1ba5212c29713" } ]
Expected behavior
Hook should update the result as per the new shipping method available on updating the address.
Before updating object is :
[ { "targetedCartLines": [ { "id": "gid://shopify/CartLine/6169802ba0c31361360e65a18d473b7c" }, { "id": "gid://shopify/CartLine/540bbb6f8e223a63103db789078c6180" } ], "deliveryOptions": [ { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-1841c728747429c89ca8980cc97b6e21", "title": "Click and Collect", "description": "Ships next day", "type": "shipping", "carrier": {}, "cost": { "amount": 0, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 0, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "Click and Collect" }, { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-945b4de19461d3c9fc765b115996e776", "title": "Standard", "type": "shipping", "carrier": {}, "cost": { "amount": 0, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 0, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "Standard" } ], "selectedDeliveryOption": { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-945b4de19461d3c9fc765b115996e776" }, "groupType": "oneTimePurchase", "isDeliveryRequired": true, "id": "gid://shopify/DeliveryGroup/269ea2856c41d63937d1ba5212c29713" } ]
Expectation result object after updating address :
[ { "targetedCartLines": [ { "id": "gid://shopify/CartLine/6169802ba0c31361360e65a18d473b7c" } ], "deliveryOptions": [ { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-48655edfe60d8e83a6e77ce9825db60a", "title": "International Shipping", "type": "shipping", "carrier": {}, "cost": { "amount": 30, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 30, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "International Shipping" }, { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-672a88b49e334faad5010a0075ad0bb8", "title": "Standard", "type": "shipping", "carrier": {}, "cost": { "amount": 1700, "currencyCode": "INR" }, "costAfterDiscounts": { "amount": 1700, "currencyCode": "INR" }, "deliveryEstimate": {}, "code": "Standard" } ], "selectedDeliveryOption": { "handle": "b87e1c5d1ba8e31bec7a79be1edb54cb-48655edfe60d8e83a6e77ce9825db60a" }, "groupType": "oneTimePurchase", "isDeliveryRequired": true, "id": "gid://shopify/DeliveryGroup/269ea2856c41d63937d1ba5212c29713" } ]
Screenshots
Expected result :![Screenshot from 2024-05-29 19-37-58](https://github.com/Shopify/ui-extensions/assets/109286689/1e612ce5-fe89-4350-a720-c8c1070d6074)
Current Result :![Screenshot from 2024-05-29 23-26-16](https://github.com/Shopify/ui-extensions/assets/109286689/5b670e39-1d7b-44b8-834b-7b5fcfcf0a76)