The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Add a Free Shipping Progress Message to the WooCommerce Cart

Shared by Amit Dholiya · August 11, 2026 · @woocommerce_before_cart

1 copy
27 views
1 upvote
Back to Snippets

Show customers how much more they need to spend to qualify for free shipping. This can encourage customers to add another product to their cart.

Steps

  1. Open your theme’s functions.php file.
  2. Add the code below.
  3. Save the file.
  4. Open the WooCommerce Cart page.

Done — a dynamic free-shipping message will appear above the cart.

function add_free_shipping_progress_message() {

    $minimum_amount = 100;

    if ( ! WC()->cart ) {
        return;
    }

    $cart_total = WC()->cart->get_subtotal();

    if ( $cart_total < $minimum_amount ) {

        $remaining = $minimum_amount - $cart_total;

        echo '<div class="woocommerce-info">
            Add ' . wc_price( $remaining ) . ' more to get free shipping!
        </div>';

    } else {

        echo '<div class="woocommerce-message">
            🎉 You qualify for free shipping!
        </div>';
    }
}

add_action(
    'woocommerce_before_cart',
    'add_free_shipping_progress_message'
);
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments