tadrik Free store check

Guides / WooCommerce

Hide other shipping methods when free shipping is available in WooCommerce

You offer free shipping above a certain order value. A customer reaches it, and checkout still lists flat rate and express next to the free option. Some pick the paid one by mistake, and some ask why they are being charged. Most shops want the paid options gone once free shipping applies. Here are two ways to do it.

What WooCommerce does itself

Free shipping can be set to appear only above a minimum amount or with a coupon (WooCommerce > Settings > Shipping > [zone] > Free shipping). But it is just another method in the zone. The flat rate and other methods still show beside it. There is no built-in setting that hides them.

Option 1: a code snippet

Add this to a small custom plugin or your child theme's functions.php. It runs after WooCommerce has worked out the rates. If a free shipping rate is there, it removes every other rate except local pickup.

add_filter( 'woocommerce_package_rates', function ( $rates ) {
    $free = array();
    foreach ( $rates as $rate_id => $rate ) {
        if ( 'free_shipping' === $rate->method_id ) {
            $free[ $rate_id ] = $rate;
        }
    }
    if ( ! $free ) {
        return $rates;
    }
    foreach ( $rates as $rate_id => $rate ) {
        if ( 'local_pickup' === $rate->method_id ) {
            $free[ $rate_id ] = $rate;
        }
    }
    return $free;
}, 100 );

Notes on the snippet:

  • The filter changes the rates before either checkout shows them, so the block checkout and the classic one both see the result. Still, put a test cart through your own checkout.
  • WooCommerce caches shipping rates. After adding the code, open WooCommerce > Settings > Shipping, then save a zone, or test in a new session, so you are not looking at old rates.
  • Other shipping plugins may register methods with their own ids. The snippet keeps only free_shipping and local_pickup, so a free rate from a plugin with a different id will not count as free.
  • A mistake in a snippet can break the site. Keep a copy of the file before you edit it.

Option 2: a rule in Tadrik Checkout Rules

Tadrik Checkout Rules is a free plugin on WordPress.org. Under WooCommerce > Checkout Rules, add a rule with the action "Hide shipping methods", pick the paid methods, and add the condition "Free shipping is on offer". Or start from the ready-made rule "Hide the other shipping methods when free shipping is on offer".

Hide Flat rate, Express when Free shipping is on offer.

Local pickup stays because you leave it out of the list. Add more conditions to the same rule when you need them: only for one country, only for one customer role, or only when the cart holds no bulky item.

Two safety points. If a rule would leave a customer with no shipping method at all, the plugin shows every method instead and warns you on the rules page. And the Test a cart tab lets you build a cart and see which methods are offered and which rule hid the rest, without placing an order.

Which should you pick?

  • Snippet: one simple behaviour for the whole store, and you are comfortable with code.
  • Plugin: the behaviour depends on country, role or cart contents, or you want to check a cart and switch the rule off without touching code.

Test it before customers do

Try three carts: one just below the free-shipping threshold (paid methods show), one just above (only free shipping and pickup), and one with a coupon that grants free shipping if you use that. Do it for a domestic and a foreign address.

Common questions

Does WooCommerce hide other shipping methods when free shipping is available? No. A free shipping method and paid ones are all shown together. WooCommerce has no setting to hide the paid ones; you need a snippet or a plugin.

Can I keep local pickup next to free shipping? Yes. In the snippet, local pickup is left out of the removal. In Checkout Rules, leave it out of the list of methods the rule hides.

Does it work with the block checkout? The snippet filters the shipping rates before either checkout shows them, so it applies to both. Test a cart on your own checkout to be sure. Checkout Rules applies its rules to the block checkout and the classic one.

What if I only want to hide the paid methods for some countries? Add a condition on the destination. In the snippet, check the package destination country. In Checkout Rules, add a shipping country condition to the rule.

Related: hide a shipping method for certain products or postcodes, and rename shipping methods at checkout.

Tadrik Checkout Rules

Hide the paid shipping options whenever free shipping is on offer. Free on WordPress.org.

See Tadrik Checkout Rules