New Shopify Certification now available: Liquid Storefronts for Theme Developers

Providing shipping rates based on a custom location selected on the cart page

deepakm
Shopify Partner
1 0 0
We are trying to provide shipping rates based on a custom location selected on the cart page. We are unable to retrieve this location while receiving the rate request from shopify.

Does anyone know a way to correlate a rate request with a cart or cart item? Or any other way to achieve the use case above?

Here is our flow:

  1. The user selects a drop location for an order on the cart page
  2. The user moves to the checkout page and provides the shipping/billing address (which will be different from 1). 
  3. Shipping rates are displayed for shipping to the drop location instead of the shipping/billing address in the checkout page. (shipping to drop locations are cheaper)



Reply 1 (1)
EcomGraduates
Shopify Partner
588 48 73

One possible solution to this could be to use Shopify's CarrierService API. With this API, you can create a custom shipping method that will calculate rates based on your own rules and algorithms.

In your case, you can use the customer's selected drop location as the destination for the shipping rate calculation. You can then return the rates that you calculate based on the destination provided.

To accomplish this, you would need to create a private app that uses the CarrierService API. You can then set up your custom shipping method and integrate it with your store's checkout process.

 

To retrieve the location selected on the cart page, you can store the information in a cookie or use the cart notes feature to store the location data. When the rate request is made, you can retrieve this data and use it to calculate the shipping rate.

banned