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).

Closing words

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 🙂

  • Jeroen Sormani

    I'm a professional WordPress plugin developer on a mission to create the best plugins for my clients. I'm specialised in developing general WordPress, WooCommerce and Easy Digital Downloads plugins.

    Interested in talking about a WordPress project? Get in touch!

    Follow me on Twitter
  • 9 thoughts on “Only show free/cheapest/most expensive shipping in WooCommerce

    Thomas K December 7, 2015 at 3:40 pm

    Wicth file does this go into?
    Tried with functions.php in my child theme and the site broke

    jeroen December 7, 2015 at 6:16 pm

    Hi Thomas,

    The code goes in your functions.php file.
    Here’s a blog I wrote some time ago about adding code snippets to your site for more details:


    Deniz February 22, 2016 at 10:11 pm

    Wow Jeroen! You really saved my time. 🙂 hah! Thank you so much.

    Vic May 18, 2016 at 4:25 pm

    Hi Jeroen,

    Would it also be possible to only select the most expensive shipping method instead of hiding the others?

    jeroen May 19, 2016 at 8:04 pm

    Hi Vic,

    It is possible, but you’d need a different code snippet then this one 😉 This code snippet is in the wrong place for doing that action.

    One challenge you’d already have if you do this, is that in WC 2.6 there will be some big changes regarding shipping, and giving priority to certain shipping rates would also get a overhaul. (just something good to know before spending hours on this and having to do it again in a few months 😉


    Bob the webbuilder May 30, 2016 at 10:11 am

    Hi Jeroen,

    Thanks for sharing, works fine!

    Mickey July 14, 2016 at 4:29 pm

    Hey Jeroen,

    Is there a way to show the most expensive method plus a free pick-up method?

    Looking forward to your reply.

    Bij voorbaat dank 🙂


    Ashley December 6, 2016 at 10:40 am

    This only ever shows one option, if there are two or more ‘most expensive’ options, how would I get them all to display?

    Jeroen December 7, 2016 at 2:21 pm

    Hi Ashley,

    Do you mean when there are two rates with the same cost?
    In that case you’d want to modify the code snippet to check for that and ensure its also saved when thats the case. It would be relatively easy to modify it to those needs.


    Leave a Reply