This shopify script is used on shopify+ Stores to reorder the shippingrates. (Great for using in combination with your custom shipping carrier service) (the first character of the shipping name should be a number (0..9)) then the script will reorder accordingly, and remove the first character
Created
December 11, 2018 22:24
-
-
Save tom-it/51f63f2937faed808f69985ec742bdac to your computer and use it in GitHub Desktop.
Shopify Reorder Shipping rates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Input.shipping_rates.each do |shipping_rate| | |
next unless shipping_rate.source != "Postnl Pakjegemak afhaalpunten" | |
shipping_rate.change_name("0" + shipping_rate.name, message: "") | |
end | |
Input.shipping_rates.sort_by!(&:name) | |
Input.shipping_rates.each do |shipping_rate| | |
shipping_rate.change_name(shipping_rate.name[1..-1], message: "") | |
end | |
Output.shipping_rates = Input.shipping_rates |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment