Add a shipping rate to the checkout page only when the user selects a delivery date from the Storefront API

Need to add a shipping rate to the checkout page when the user selects the delivery date. Thinking to do this from the Storefront API, getting 401 as well when trying to mutate UpdateShippingLine . Any heads up or alternative?

Hi Iman,

I think using a Shopify Function might be the best option here, possibly using the Delivery Customization Function API.

The delivery customization API supports only renaming, reordering, and hiding shipping rates; it cannot add new shipping rates. It seems you need to add a shipping rate based on the customer-selected date from the storefront. To achieve this, you can use the Carrier Service API.

Please refer to the documentation:

The date selected from the storefront is properly passed as a line item properties in the cart and will be available in the carrier service request. Using this date, you can return the newly calculated shipping rates

3 Likes