Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
This question is about storefront API specifically on checkout. I have my own dynamic shipping rate calculator API which I want to use on checkout. That means I do not have any shipping rates set on Shopify Admin. Is there any mutation I can use on the Checkout API that does this? I am aware of the checkoutShippingLineUpdate mutation but that relies on a shippingRateHandle that needs to exist in the Shopify Admin. Appreciate any help on this. Thanks!
Hi @g3misa,
Thanks for your post. There is not any direct mutation to get custom rates into the checkout.AvailableShippingRates in the Storefront API. The way to connect a dynamic shipping rate calculator would be to set it up as a CarrierService server that provides rates when queried, and which currently can only be set up via REST API:
https://shopify.dev/docs/api/admin-rest/2023-04/resources/carrierservice
This would also require that the store has the carrier calculated shipping option enabled which is only available on some plans. Once the carrier service is set up and working the rates from it come through when querying checkout.AvailableShippingRates in the Storefront API.
Hope you have a great day,
Jon551
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog