WooCommerce : How to make free shipping the only option


If you ever come to situation where you need to make “Free Shipping” as the only shipping option when your total cart total is more than a set amount, then this post will provide you some insight or idea.

For example, you set amount is $50. If user cart total is more than $50, then apply free shipping only.

Step 1: Open your functions.php file at your current theme folder (wp-content/themes/[THEME]/functions.php) You can download functions.php file from FTP, edit then upload again, OR you cab go to WordPress Admin -> Appearance -> Editor, and click functions.php to edit then save.

Step 2: Put below code to the bottom of the file:

add_filter( 'woocommerce_available_shipping_methods', 'remove_standard_shippings_when_free' , 10, 1 );

function remove_standard_shippings_when_free( $available_methods ) {

    //get cart total from session
    $total = 0;
    $session_cart = $woocommerce->session->cart;
    if(count($session_cart) > 0) {
        foreach($session_cart as $cart_product)
            $total = $total + $cart_product['line_subtotal'];

    if( isset( $available_methods['free_shipping'] ) ) {
        // remove all standard shipping options
        unset( $available_methods['flat_rate'] );
        unset( $available_methods['international_delivery'] );
        unset( $available_methods['local_delivery'] );
        unset( $available_methods['local_pickup'] );

 return $available_methods;
WooCommerce Standard Shipping Options

WooCommerce Standard Shipping Options

Final Step: Save the file above and done. You’ve told WooCommerce to remove all other shipping options (flat rate, internatinal delivery, local pickup and local delivery) when cart/order total is over $50 and apply free shipping option only.

Hope you get some idea on how to tweak WooCommerce by reading more my articles.


  1. Doesn’t work for me. It removes flat rate option but only the basic one and even then it shows several times
    Notice: Undefined variable: woocommerce in /vol/…/wp-content/themes/my-primashop-wc/functions.php on line 24

    Notice: Trying to get property of non-object in /vol/…/wp-content/themes/my-primashop-wc/functions.php on line 24
    where 24 line is
    $session_cart = $woocommerce->session->cart;

    When there’s Additional Rates ex.
    express | 5 | order – it removes only basic flat rate option and user can still choose between express and free delivery option.

    I use premium theme and it’s used on site within multisite installation.

  2. Hi,
    I tried using your code,it is not working for me. It still shows other shipping options too.My woocommerce version is Version 2.1.12 .

    please help

  3. Thank you for the code.
    But I’m using additional rates in the flat rate tab.
    And these additional rates keep showing when free shipping method is available.

  4. Hi!

    Do you have any idea how to update flat_rate and local_delivery price if freeshipping is available?

  5. Thanks a lot for sharing this. It gave me enough clues to rework it to be able to show or not show other active postage methods based on whether the minimum spend condition on the free shipping method was reached. Much appreciated.

  6. hi I don’t want this minimum order to be enforced for local pickups.actually my code add_action( ‘woocommerce_checkout_process’, ‘wc_minimum_order_amount’ );
    add_action( ‘woocommerce_before_cart’ , ‘wc_minimum_order_amount’ );

    function wc_minimum_order_amount() {
    // Set this variable to specify a minimum order value
    $minimum = 97;

    if ( WC()->cart->total cart->total )
    ), ‘error’

    } else {

    sprintf( ‘You must have an order with a minimum of %s to place your order, your current order total is %s.’ ,
    wc_price( $minimum ),
    wc_price( WC()->cart->total )
    ), ‘error’


    this i applied but now i dont want this to minimum order to be enforced for local pickups.

Leave a Comment.