In my experience around shipping in WooCommerce I’ve found that there are countless different needs for setting up shipping cost. One that comes back from time to time is setting up a minimum or maximum shipping cost to shipping rates. In this post I’ll show you ways on how you can setup these caps on your shipping cost.

Setting up a maximum shipping cost

Depending on your needs you may want to setup a maximum shipping cost for all shipping rates. In the code snippet below it will put the maximum shipping amount you entered on all the shipping rates and automatically adjust the shipping rates.

Apply maximum shipping cost to certain shipping rates

Of course setting up a maximum shipping cost for all shipping rates may not go well if you have some sort of for example a setup with both standard and expedited shipping. This code snippet will allow you to only setup the maximum to certain shipping rates based on their shipping rate ID.

Setting up a minimum shipping cost

If you want to setup a minimum shipping cost, the example below will setup a minimum shipping cost of $10 for each shipping rate.

Setup minimum shipping cost to certain shipping rates

Just like the maximum shipping cost example, setting up a minimum cost for each rate may not be what you need. In the example below you can setup the minimum shipping cost per shipping rate. You can enter multiple shipping rates in the comma separated list if want to.

Closing words

If you’re using my Advanced Shipping plugin and want to setup the min/max shipping cost based on the shipping rate IDs, you can find the IDs of the shipping rate in the URL when editing a shipping rate. For example, if the URL is http://mydomain.com/wp-admin/post.php?post=123&action=edit, then 123 would be the shipping rate ID.

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
  • 2 thoughts on “Putting a limit / minimum on your shipping cost

    Rey October 18, 2016 at 4:03 pm

    Hi Jeroen,

    Thanks for this, i been searching for this kind of function, But how can this be applied for a multiple shipping method with its own minimum purchase.? For example flat rate for $10 and store pickup for $15.

    Jeroen October 18, 2016 at 7:31 pm

    Hi Rey,

    You’d need to customize the code a bit, but this is definitely possible. I think the easiest way would be to grab the second code snippet and add those multiple times for your different rates. Do remember to change the function name for each, otherwise those will clash.


    Leave a Reply