Webshipper returns all the drop-points sorted by distance when Shopify asks for them, however Shopify reorders them based on name and price instead and doesn't provide a way to turn this off.

To accomodate our wonderful Shopify customers, we've made it possible to sort the drop-points using Shopifys' Script Editor, unfortunately though, this is only for Shopify Plus subscriptions.

All you have to do to start reordering the drop-points by distance is to download the *Script Editor* from the Shopify App store.

Find the Script Editor, and add it.

Then open up the app by clicking on it from the app-page.

Create a new script

Pick a blank shipping rate template

Name it "Sort shipping rates"

And enter this code into the script:

i = 25

Output.shipping_rates = Input.shipping_rates.sort_by do |rate|
  i += 1
  is_prefixed = Float(rate.name[0...2]) >= 0 rescue false
 
  order = Float(rate.name[0...2]) rescue i
 
  if is_prefixed
    rate.change_name(rate.name[2...999], message: rate.markup)
  end
 
  order
end


Click "Save and publish", and you're all done with Shopify.


Now Login to your Webshipper account, go to settings, and find Order Channels

Find your Shopify Order Channel, and edit it

Now check "Prefix Droppoints"

And you're all done.

Did this answer your question?