See how to sort drop point in Shopify by other means than alphabetically
Sometimes you want a different sorting of your drop points, then alphabetical. However, Shopify will reorder them based on name and price and doesn't provide a way to change that.
To accommodate our wonderful Shopify customers, we've made it possible to sort the drop-points using Shopify's' Script Editor, but also with a set prefix.
Unfortunately, the Script Editor is only for Shopify Plus subscriptions.
With customisable prefix
Select "Prefix droppoints"
Select "Set new prefix"
This should leave your with an input field, where you can type in the prefix for droppoints. Writing "1" will replace that number with the index of the droppoint.
So writing "Droppoint 1" will make the closest droppoint in the checkout, start with "Droppoint 1", "Droppoint 2", "Droppoint 3" etc.
Since Shopify use alphabetical sorting, this means that the closest droppoint will remain as the first option.
With script editor
1. To start - download the "Script Editor" from the Shopify App Store.
2. Find the Script Editor, and add it.
3. Afterward, open the app by clicking on it from the app-page.
4. Create a new script by pressing this button.
5. Select a "Blank Template" for now.
6. Name it something recognizable like "Sort shipping rates".
7. And copy this string of 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
rate.change_name(rate.name[2...999], message: rate.markup)
Click "Save and publish" to wrap up the Shopify part of the setup.
8. Switch to your Webshipper account, find your order channel and click "Edit Order Channel".
You are looking for the option "Prefix Droppoints".
and then selecting "With Shopify script editor"
Once that is enabled, your rates will now be listed from closest to furthest.
You're all done :)