Overview
↑ Back to topBy default, WooCommerce will show all shipping methods that match the customer and the cart contents. This means Free Shipping will also show along with Flat Rate and other Shipping Methods. The functionality to hide all other methods and only show Free Shipping requires either custom PHP code or a plugin/extension.
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 topBefore adding snippets, clear your WooCommerce cache. Go to WooCommerce > System Status > Tools > WooCommerce 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.
PHP Snippets
↑ Back to topHow do I only show Free Shipping?
↑ Back to topHides everything but free_shipping
if it’s available and is compatible with Shipping Zones.
How do I only show Local Pickup and Free Shipping?
↑ Back to topHides everything but free_shipping
and local_pickup
if it’s available and is compatible with Shipping Zones.
Only show free shipping in all states except…
↑ Back to topShow only free shipping in all states except the exclusion list. Hide free shipping if the customer is in one of the states listed:
Is there a plugin available for this?
↑ Back to topYes, you can also use this free plugin instead of the first two snippets: https://wordpress.org/plugins/wc-hide-shipping-methods
Enable Shipping Methods on a per Class / Product Basis, split orders, or other scenarios?
↑ Back to topNeed more flexibility? Take a look through our premium Shipping Method extensions.