Buy All 47 Premium Themes For the Price Of $199.99

How to Show a Free Shipping Progress Bar in WooCommerce Using Hooks

A free shipping progress bar is one of the most effective UX features you can add to a WooCommerce store.
It motivates customers to add more products to their cart in order to reach free shipping.

In this tutorial, you will learn how to create a dynamic progress bar using WooCommerce hooks.

Why This Feature Increases Sales

Customers love clear goals. When they see how close they are to free shipping, they often spend more.

  • Increases average order value
  • Encourages extra product purchases
  • Reduces cart abandonment
  • Improves overall user experience

The WooCommerce Hook We Will Use

We will use:

woocommerce_before_cart

This hook allows us to display content at the top of the cart page.

Example Code

Add the following code to your theme’s functions.php file or a custom plugin:


add_action('woocommerce_before_cart', 'free_shipping_progress_bar');

function free_shipping_progress_bar() {

    $free_shipping_threshold = 100;

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

    if ($cart_total >= $free_shipping_threshold) {
        echo '

You have unlocked free shipping!

'; return; } $remaining = $free_shipping_threshold - $cart_total; $percent = ($cart_total / $free_shipping_threshold) * 100; echo '
'; echo '

Add $' . $remaining . ' more to get free shipping!

'; echo '
'; echo '
'; echo '
'; echo '
'; }

How It Works

The function checks the current cart total and compares it with the free shipping threshold.

  • If the threshold is reached → success message appears
  • If not → progress bar shows remaining amount

Customization Ideas

  • Change threshold per country or user role
  • Show messages on product pages too
  • Add animations for progress bar
  • Integrate with AJAX cart updates