See how to sort drop point in Shopify by other means than alphabetically
Sometimes you want a different sorting of your drop points than 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 Shopify Script Editor is only for Shopify Plus subscriptions.
Get started with Webshipper prefix
1. Navigate to Settings > order channels > select channel > edit order channel
2. Select "Prefix drop points"
3. Select "Set new prefix"
4. This will leave you with an input field, where you can type in the prefix for drop points. Writing "1" will replace that number with the index of the drop point. So writing "Drop point 1" will make the closest drop point in the checkout, start with "Drop point 1", "Drop point 2", "Drop point 3" etc. Since Shopify use alphabetical sorting, this means that the closest drop point will remain as the first option.
Get started with Shopify 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 :)