Posted on

Hide other WooCommerce shipping methods when “Free shipping” (or “Flat rate”) is available

Hiding the other WooCommerce shipping methods when “Free shipping” is available is a common request from our web development customers, so in 2020 we launched a free plugin called “Free shipping and hide other methods for WooCommerce” which not only solved our customer’s need, as helped us in our mission to give back to the WordPress community with yet another free plugin.

We created a new “Free shipping (hide other methods)” shipping method, by extending the native WooCommerce “Free shipping” method and listing all the other methods available, in the same zone, so that the shop owner can choose which methods to hide.

Last week we were faced with a similar request by another of our customers:

We are starting to sell physical gift card and charge a flat rate to ship it, and hide all the other regular shipping methods.

Whatever solution we choose to use, we also need to make sure this flat rate is only available if the order only has gift cards, and if the order has regular products and gift cards, the other shipping methods should show up.

It was obvious for us that we should fill this necessity with the same approach we used before: extend the native WooCommerce “Flat rate” method and allow for other methods to be hidden. We also added a new “Flat rate requires” field with a single “All products are in the same shipping class” option and the possibility of choosing the class. This option was also originally added to the free shipping method on the first release.

Today we released version 2.0 of our free plugin under a new name: “Free shipping + Flat rate and hide other methods for WooCommerce” with the new “Flat rate (hide other methods)” shipping method, on WordPress.org