Hide all shipping methods except Free Shipping in WooCommerce

If free shipping is available, you possibly don’t need any other option to be displayed. Here in this snippet, we will see how to disable all the shipping methods except ‘Free Shipping’.
Add the following to the function.php in your child theme.

 * Hide shipping rates when free shipping is available.
 * Updated to support WooCommerce 2.6 Shipping Zones.
 * @param array $rates Array of rates found for the package.
 * @return array

function wps_hide_shipping_when_free_is_available( $rates ) {

	$free_shipping = array();

	foreach ( $rates as $rate_id => $rate ) {
		if ( 'free_shipping' === $rate->method_id ) {
			$free_shipping[ $rate_id ] = $rate;

	return ! empty( $free_shipping ) ? $free_shipping : $rates;


add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 );

Edit WooCommerce Products from Frontend

Leave a Comment

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

Scroll to Top