You may have setup different shipping rates in your WooCommerce store. What you want and need to charge for shipping is different in each webshop and it is very hard to set things up exactly the way you need it. In this post I will show you how you can only show the cheapest shipping method or the most expensive one.
Only show the cheapest shipping rate
One of the reasons you might want to only show the cheapest rate is because you’re using the different shipping rates form different shipping carriers. To make it easier to your customers you may only want to to show the cheapest shipping rate. To filter out the other rates you can use the following custom code;
This code will ensure only the cheapest shipping rate of ALL your rates is being shown. Keep in mind that this could also be free shipping if that is something you’re offering.
Only show the most expensive shipping rate
There are also different reasons why you may want to only show the most expensive shipping rate available. For example, if you’ve setup shipping rates with a cost based on the class. It could be that you can include some of the lighter items you sell within a heavier/bigger package. In that case it would be good to only show the most expensive shipping rate so you will not lose money on the shipping cost.
The following code is almost the same as the code above and can be used in the same way.
Only show free shipping when available
If you offer free shipping rates you may also want to hide the other shipping rates as it doesn’t always make sense to offer paid shipping when there’s also free shipping available (sometimes it is, but it could be that the free shipping/paid shipping are exactly the same).
The following code will only show all the free shipping rates, meaning that if you’ve setup local pickup for example this will still be a option for the user. With the following code only the free shipping rates will show when there is a free shipping available, but it does make sure that it shows the regular shipping rates when local pickup is available (you probably do want to offer the choice to pickup or ship).
Showing only one correct shipping rate will help your customers with the checkout as they’ve got one less decision to make. These code snippets will hopefully help you show the right shipping rates in your webshop.
Please leave a comment below if this was helpful for you, or if you ran into any challenges 🙂