This article is only useful when the Shopify Plus integration is used
By default shipping methods are sorted by Rate (lowest first) and then alphabetically.
Sometimes you want you to adjust it. For instance you want to provide your Pick-up Point option for free but then this option is listed first because it is sorted on alphabet.
Within Shopify Plus you can influence this. You will have to install the Scripts Editor of Shopify.
Setup Shipping Method script
Open the Scripts Editor in your shop.
Choose to Create a new Script (button in the upper right corner). You will see the modal like the one below. Pick Shipping rates and choose for Reorder shipping rates.
Change the contents of the script. Below the script that you can copy and paste. Make sure that you change the items in the desired_order variable to the items you have in your store.
# Create array of shipping methods desired_order = ["Standard Shipping", "Pick-up at PostNL pick-up point","Pick-up at one of our stores"] # Reorder the payment gateway methods to the order of desired_order. Output.shipping_rates = Input.shipping_rates.sort_by do |shipping_rate| desired_order.index(shipping_rate.name) || desired_order.length end
Make sure that you Save and Publish this script.
When you check the sorting of the Shipping methods in your checkout you will notice the sorting. It is exactly the same as the sorting in your script. Standard Shipping is shown first.