Search code examples
reactjsshopifyshopify-appshopify-apishopify-storefront-api

Is there a way to show custom calculated delivery dates in Shopify?


I have a Shopify store and I would like to, on the shipping page in the checkout, show delivery dates under shipping methods. To calculate the delivery dates I need item's SKUs in the cart, the shipping address, the store name (because I have multiple stores actually) and the shipping methods "DeliveryMethodDefinition" IDs.

I tried to retrieve the data in a checkout extension ui app, I can get the store name directly by using "shop" from useApi and the items skus by using query, but impossible to get "DeliveryMethodDefinition" ids and shipping address. Is there a way to get the cart id in the shipping page so I could make a call to a personal api to calculate it and send it back to make the checkout extension UI to show it?

And I am not talking about the checkoutToken as it is deprecated in the order resource.

I also searched in the docs to try something else, found something called carrier service but couldn't use it. I am not even sure if it was the thing I needed.


Solution

  • As of Shopify API version 2024-01 :

    You can set delivery dates only for shipping rates that are provided by a carrier_service resource created by your app.

    It others terms, you can't set delivery dates for shipping rates that are :

    • created manually in Shopify admin
    • provided by another app

    Note : if you want to implement a carrier_service thing, you may want to check how the delivery dates are displayed in the checkout process. You may have unexpected results when your minimum and maximum delivery dates include non-working days.