Out now! Check out the Poll results: Do you have a Shopify store?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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

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
764 67 112

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.


 If this fixed your issue, likes and accepting as a solution are highly appreciated
|  Build an online presence with our custom-built Shopify Theme: EcomifyTheme
|  Check out our reviews: Trustpilot Reviews
|  We are Shopify Partners: EcomGraduates Shopify Partner