Patrick's Programming Blog

WooCommerce Sort Shipping Methods By Cost

WooCommerce has plenty of shipping options. You can use USPS, FedEx, UPS, flat rate shipping, free shipping, or even create your own table rates. Lots and lots of options for you. If you want to give your customer the choice between these options it can be a bit difficult. WooCommerce will lump the different services together which is nice if you want to see all the USPS, FedEx, UPS, etc. options together. But it doesn't help you if you want to sort by cost and that's how most users want to see things. Either by cost or by delivery time. With a bit of code you can sort the options by cost.

WooCommerce Shipping Costs

The WooCommerce shipping methods in the default order.

Sort by Cost

If you want to sort all your options by cost then you need to use a tincy snippet which you can add to your theme's functions.php.

Once you do this all the shipping methods will be sorted by cost from lowest to highest. This example only shows you 3 different methods but with USPS, free shipping, and flat rate shipping it could be a dozen different options.

WooCommerce shipping methods ordered lowest to highest.

Make it Understandable

Since all of the options will be mixed up it's worth going into the settings and making it a bit easier to read. With any of the plugins from WooThemes you can go into the settings and change the names. For USPS you go to WooCommerce -> Settings -> Shipping -> USPS and then change the names.

The USPS services names. You can type in anything you want. I've added “USPS” to the front of all of mine.

Happy shipping!

Exit mobile version