in

How to Hide Other Shipping Methods When Free Shipping Is Available in WooCommerce

Want a cleaner WooCommerce checkout? This guide explains how to hide other shipping options when free shipping is available, with a practical snippet you can safely add and customize. You’ll also learn how to test it in your cart and troubleshoot common shipping issues.

Offering free shipping is a great way to encourage WooCommerce customers to complete their purchases, but showing paid delivery options alongside it can cause confusion. The good news is that you can automatically hide other shipping methods whenever free shipping is available.

In this guide, you’ll find a simple WooCommerce snippet to hide shipping methods when free shipping is available, so customers see only the options that apply. We’ll also cover how to add the code safely and adjust it to fit your store’s shipping setup.

How the WooCommerce hide shipping method when free shipping available snippet works

At checkout, the list of delivery choices can change as a shopper’s cart or address changes. Understanding how WooCommerce builds that list makes it easier to see when a hide-method snippet will help—and when it might hide an option you want to keep.

The key detail is that shipping choices depend on the customer’s package, destination, and the rules configured in your store. First, let’s look at how WooCommerce decides whether free shipping qualifies.

How WooCommerce determines whether free shipping is available

WooCommerce calculates shipping rates for a package using the shipping zone that matches the customer’s address. Within that zone, it checks the available methods and their conditions, such as a minimum order amount, a qualifying coupon, or no additional requirement.

If a free shipping method meets its configured conditions, WooCommerce includes it among the package’s rates. A typical snippet checks for that rate—often identified by the method ID freeshipping—before changing the checkout options. This means the free option must actually qualify; simply adding free shipping to a zone does not make it available for every order.

Once WooCommerce has calculated the eligible rates, the snippet can decide which ones customers see. Its exact behavior depends on how the code is written, so it’s worth checking the method IDs in your own shipping setup.

Which shipping methods the snippet hides

A common approach keeps the free shipping rate and removes other rates from the same package. For example, if a customer qualifies for free shipping alongside flat-rate and express delivery, the checkout may show only the free option.

Depending on the snippet’s conditions, other methods that could be removed include:

  • Flat-rate shipping, such as a standard delivery charge.
  • Express or priority services offered by a carrier or shipping plugin.
  • Local pickup, if the code excludes every rate other than free shipping.

That last case matters: a broad rule may hide useful choices unintentionally. You can adjust the logic to preserve specific methods, and stores that split orders into multiple packages should test how the rule behaves for each package.

With those details in mind, consider whether removing paid choices fits the way you want customers to shop. The right setup depends on your shipping promises and the options shoppers should retain.

When to use WooCommerce hide shipping method when free shipping available

This approach works well when free shipping is intended to replace standard paid delivery, rather than sit beside it as one choice among several. It can make checkout simpler and prevent customers from paying for a service they could receive at no cost.

Keep other rates visible if they offer meaningful alternatives, such as faster delivery or pickup. Before applying a WooCommerce hide shipping method when free shipping available rule across your store, test carts that do and don’t meet the free-shipping conditions, along with different destinations and shipping zones. The goal is a clearer choice—not fewer choices at any cost.

Add and customize the WooCommerce snippet

Once you’ve decided which choices should remain at checkout, the next step is adding the rule where it can run safely. A small change to the snippet can also preserve useful options, such as local pickup, while hiding the rates you don’t want displayed.

Start by choosing a place for custom code that won’t be lost during a theme update. These options let you test and manage the rule without editing WooCommerce core files.

Where to add the code safely

For most stores, a code snippets plugin is a convenient choice: you can activate or deactivate the rule without changing theme files. Alternatively, add it to your child theme’s functions.php file. Avoid editing WooCommerce core files or a parent theme, because updates can overwrite your changes.

Before making changes, back up your site and test on a staging copy if possible. Add the snippet without a PHP opening tag when your plugin or file already provides one, then enable it and check checkout with a qualifying and a non-qualifying cart.

With a safe location in place, you can add a basic version of the rule. It keeps eligible free-shipping rates and returns the original rates when free shipping isn’t available.

WooCommerce snippet to hide shipping methods when free shipping is available

Add this PHP code to your chosen location. The filter runs for each shipping package, so the rule applies to the rates WooCommerce has calculated for that package.

addfilter( 'woocommercepackagerates', 'hiderateswhenfreeshippingisavailable', 100 );
function hiderateswhenfreeshippingisavailable( $rates ) {
    $freerates = array();
    foreach ( $rates as $rateid => $rate ) {
        if ( 'freeshipping' === $rate->methodid ) {
            $freerates[ $rateid ] = $rate;
        }
    }
    return ! empty( $freerates ) ? $freerates : $rates;
}

The check uses the method ID freeshipping, not the rate’s display name. When a free rate qualifies, all other rates in that package are removed—including pickup—so review the result before using it on a live store. The WooCommerce code reference documents the package-rates filter used here.

If your checkout needs more nuance, adjust the conditions rather than applying the same rule to every rate. The key is to match the method identifiers and package behavior in your setup.

Adapt the snippet for specific shipping methods or zones

To retain local pickup, update the if condition so it also keeps rates whose method

id is localpickup. You can use the same approach for another method, but confirm its ID first; a rate’s checkout label may differ from its internal identifier.

For zone-specific behavior, compare the rate’s instanceid with the shipping method instance you want to target, or inspect the package destination passed to the filter. Test each relevant zone and package, especially if orders can split into multiple shipments, and clear any shipping or page cache before checking your changes.

Test and troubleshoot your shipping setup

A checkout can look perfect with one test order and behave differently when the destination or cart changes. A few deliberate checks will help confirm that customers see the right choices—and that the rule keeps working as your store changes.

Start with the situations most likely to affect eligibility, then investigate any result that doesn’t match your shipping policy.

Test WooCommerce hide shipping method when free shipping available in the cart

Use a staging site if available, and try a range of carts rather than relying on a single checkout. The goal is to confirm both sides of the rule: free shipping replaces the intended rates when it qualifies, while other options remain available when it doesn’t.

Check cases such as:

  • A cart below and above the free-shipping minimum.
  • A qualifying and non-qualifying coupon, if coupons affect eligibility.
  • Different addresses that use different shipping zones.
  • A cart with products that may ship in separate packages.

Also verify that any method you intend to preserve, such as pickup, remains visible. Changing the address or cart can trigger a fresh rates calculation, so test those changes at checkout—not just on the initial page load.

If the results differ from what you expect, check the shipping configuration before changing the PHP. The following checks can help narrow down whether the issue is eligibility, rate identification, or cached checkout data.

Fix common issues with hidden shipping methods

If paid options still appear, first confirm that free shipping is actually available for that order. Check the matching zone, method settings, minimum amount, and coupon requirements; the snippet can only filter a free rate WooCommerce has calculated.

If every option disappears or a preferred service is missing, review the rate IDs and the snippet’s conditions. A display label may not match a method’s internal ID, and the basic rule removes every rate except free shipping. Also consider whether a plugin or custom checkout is modifying rates.

When checkout shows stale results, clear relevant caches and recalculate the cart. Test again in a private browser window, and review your site’s PHP error log if enabling the snippet causes an error. Change one thing at a time so you can identify the cause.

Once the behavior is correct, keep the code easy to maintain. WooCommerce updates don’t normally overwrite a snippet stored outside its core files, but updates can still affect extensions or checkout behavior.

Keep the snippet working after WooCommerce updates

Store the rule in a snippets plugin or child theme, not in WooCommerce core or a parent theme. After updating WooCommerce, your theme, or a shipping extension, repeat the key cart and destination tests on staging before relying on the live checkout.

Keep a note of the snippet’s purpose, any preserved method IDs, and the tests you performed. If an update changes how rates are returned, temporarily disable the snippet to help isolate the issue, then review the relevant WooCommerce code reference before adjusting it.

Make free shipping a clear, reliable checkout choice

Hiding other shipping rates when free shipping qualifies can make checkout simpler and help customers understand the options available to them. The right setup depends on your store’s policy: keep the basic rule if free shipping should replace every other method, or adjust it to preserve choices such as pickup or express delivery.

Add the snippet somewhere safe, confirm it matches your shipping methods and zones, and test carts, destinations, and packages both with and without free-shipping eligibility. After WooCommerce or shipping-extension updates, repeat those checks to catch changes before they affect customers.

With a little testing and maintenance, you can offer a cleaner checkout while ensuring shoppers still see the delivery options that matter.

Leave a Reply

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

      Written by Maeve Rodriguez

      Maeve is a Business Content Writer and Front-End Developer. She's a versatile professional with a talent for captivating writing and eye-catching design.