Having free shipping available for your store is a great way to reduce friction and minimize the checkout abandonment rate. It makes sense to remove other shipping rates such as paid options when a free option is available. In other scenarios offering additional rates such as local pickup and premium/expedited rates is beneficial for the customer.

In this post there are different ways on how other shipping rates can be hidden when free is available. For example to hide all other options, only the paid options or some specific rates.

Hide All Shipping Rates when Free Shipping is Available

This first snippet is the simplest. Hiding all the other shipping options, making the free shipping option the only one available. This checks against the ‘Free shipping’ methods setup in the WooCommerce Shipping Zones, when one is available it will hide all but the free shipping rates.

Having only one shipping option available has the added benefit that the customer does not have to make any additional choices for the shipping. By default WooCommerce would display radio buttons for the different available options, but with only one shipping rate there it won’t show up as a option.

Before all rates appear, after only free shipping is available
Before all shipping rates appear, after only free shipping

Keeping Local Pickup Available

With the previous code snippet rates such as local pickup are hidden. Even when offering free shipping, the customer may prefer to pickup the order instead. Thats why this code snippet will be a small modification on the above; with this change it will keep any local pickup shipping options available as well.

Hiding All Paid Shipping Rates when Free is Available (with other shipping types)

The first and second code snippets are looking for the ‘Free Shipping’ method only. Using a different solution such as the Advanced Free Shipping or the Advanced Shipping plugins to create free shipping options it is not recognized by the prior snippets. By making some changes it will be possible to keep all the free options available, which would recognize rates from any method type, including Free Shipping, Local Pickup and any other custom shipping methods.

Keeping a Paid Shipping Rate Available

So far we’ve always hidden any and all paid shipping rates. In cases where you’re offering free shipping for the ‘regular’ shipping option, having a Premium or Expedited option available can be beneficial for the customer to receive their products more quickly.

In the code snippet below it will look and preserve for all the free shipping options like the previous code snippet, but with the ability to keep certain (paid) shipping rates available as well.

About the author: Jeroen Sormani is actively building WordPress, WooCommerce and Easy Digital Downloads plugins. Slightly obsessed by writing high quality code.
Follow Jeroen on Twitter

2 comments

    1. Hi Pavel,

      That is odd, so far I’m unable to reproduce. The error indicates that there is a incorrect value provided to a WC Core function, but I don’t see any reason why the snippet would cause this.
      Did you maybe also try another solution that may still be present in your site that can cause this?

      Cheers,
      Jeroen

Leave a Reply

Your email address will not be published. Required fields are marked *