How to Show the 'Amount Left for Free Shipping' in WooCommerce

Last edited:2025-11-10

You know that moment when your customer is this close to getting free shipping, but they just don’t know it?
Yeah — that’s a missed opportunity.

Luckily, WooCommerce makes it easy to gently nudge them with a simple message like:

“Add $5.75 more to your cart to get Free Shipping!”

Not only does this improve the shopping experience, but it also encourages higher order values — and who doesn’t love that?

In this post, I’ll show you how to add a friendly “free shipping progress” notice to your WooCommerce cart page.


The PHP Magic ✨

Here’s a clean and reusable snippet you can drop into your theme’s functions.php file or your custom plugin:

add_action( 'woocommerce_before_cart', 'cv_show_free_shipping_notice' );

function cv_show_free_shipping_notice() {
    
    $free_shipping_min = 30; // Set your free shipping threshold
    $cart_total = WC()->cart->subtotal;
    
    if ( $cart_total < $free_shipping_min ) {
        $remaining = $free_shipping_min - $cart_total;
        $message = 'Add ' . wc_price( $remaining ) . ' more to your cart to get free shipping!';
        $shop_url = wc_get_page_permalink( 'shop' );
        $notice = sprintf(
            '<a href="%s" class="button wc-forward">%s</a> %s',
            esc_url( $shop_url ),
            'Continue Shopping',
            esc_html( $message )
        );
        wc_print_notice( $notice, 'notice' );
    }
}

How It Works

Here’s the breakdown of what’s happening:

  1. Hooking into the cart
    The woocommerce_before_cart action runs just before the cart content loads, making it a perfect place for friendly reminders.

  2. Setting the free shipping threshold
    $free_shipping_min is where you define your free shipping limit — in this example, $30.

  3. Calculating how much is left
    By subtracting the current subtotal from the threshold, we know how close the customer is to free shipping.

  4. Displaying the message
    wc_print_notice() handles the display. We add a “Continue Shopping” button for a nice finishing touch.


Example in Action 🛒

If your customer’s cart total is $22, they’ll see:

“Add $8.00 more to your cart to get free shipping!”

Once their cart total reaches $30 or more — boom — the notice disappears like a satisfied ghost. 👻


Why It Works (Beyond the Code)

This little feature adds a subtle bit of gamification to your checkout flow.
It makes customers feel like they’re almost winning something, which can nudge them toward completing the purchase.

It’s not pushy.
It’s not flashy.
It’s just a helpful reminder that says, “You’re so close — go on, add that extra item!”


💡 Pro tip: You can also adapt this snippet to show progress bars, popups, or mini-cart messages for a more dynamic shopping experience.


That’s it — a simple UX boost that improves conversions, makes your customers happier, and gives your cart page a little extra sparkle ✨.

#Cart#Free Shipping#Hooks#UX
← Back to Blog