Hide other shipping methods when “Free Shipping” is available

This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

If you’d like to see this feature added to WooCommerce core, visit our Ideas Board and add your vote to it. The more popular an idea becomes, the more of a priority it is for our developers to review.

Adding code ↑ Back to top

Before adding snippets, clear your WooCommerce cache. Go to WooCommerce > System Status > Tools > WC Transients > Clear transients.

Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.

Snippets for WC 3.0+

Hides everything but free_shipping if it’s available and is compatible with Shipping Zones.

You can also use this free plugin https://wordpress.org/plugins/wc-hide-shipping-methods/.

Snippets for WC 2.5

How do I show only Local Pickup and Free Shipping?

This can be done by using this free plugin https://wordpress.org/plugins/wc-hide-shipping-methods/ or with the following code snippet

Show only free shipping in all states except… ↑ Back to top

Show only free shipping in all states except exclusion list. Hide free shipping if the customer is in one of the states listed:

Enable Shipping Methods on a per Class / Product Basis ↑ Back to top

Need more flexibility? We recommend this free plugin!

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top