Everybody wants to increase the average order value for their store, right? A good way to do this is to offer free shipping above a certain order amount. If you have this on your site you should of course promote this as a selling point on a prominent and default position.

Alongside with that, it would be good to help the customer remind in the cart if they’re close to the free shipping amount with a notification saying something like “Add $10 more to your basket to receive free shipping!”.

In this post I’ll provide a code snippet that you can use to display such message on the cart/checkout page when using the WooCommerce Core ‘Free shipping’ option. I’ll also provide a solution when using the Advanced Shipping or Advanced Free Shipping plugins.

Showing a free shipping notice for WooCommerce Core free shipping rates

Using the following snippet you can show the notice on the cart / checkout page. It will only appear when the minimum order amount setting is set.

You can remove some of the lines if you only want to display it at the cart / checkout page as described inline.

Showing a free shipping notice for Advanced Shipping

If you setup a free shipping option with the Advanced Shipping / Advanced Free Shipping plugin then the above code snippet won’t work as that only recognises the ‘Free shipping’ rate of WC Core and the respective settings. Because of the conditions it is very difficult to setup a code snippet that would fit the exact requirements.

Therefore the easiest solution would be to use the Advanced Messages plugin. Just like the other ones, this plugin has similar conditions and will allow you to setup conditional messages throughout your store.

Here’s how an example setup would look like;

1. The free shipping rate

2. The message

The message would have a similar setup. I’ve added a additional condition to ensure it doesn’t show when there’s too big of a gap between the free shipping amount and the cart subtotal.

3. The message at the cart

Jeroen Sormani

I'm a professional WordPress plugin developer on a mission to create the best plugins for my clients. I'm specialised in developing general WordPress, WooCommerce and Easy Digital Downloads plugins.

Interested in talking about a WordPress project? Get in touch!

Follow me on Twitter

51 thoughts on “Showing a ‘Add $10 more for free shipping’ notice

Navraj Singh August 27, 2020 at 3:12 pm

Thanks! It worked like a charm.

mjunes February 16, 2021 at 6:49 pm

Hello, how to change the amount when the cart is updated without page refresh? Like say, when the quantity of a product is increased? The cart updates via ajax but the amount remaining stays the same unless the cart page is refreshed.

Jeroen Sormani February 17, 2021 at 2:46 pm


This would require some more code to accomplish, first to remove existing notices, and then to add/insert the new notice (or amount).

chucknology February 25, 2021 at 10:55 am

Great snippet Jeroen but where can I set the minimum order amount?

Jeroen Sormani April 5, 2021 at 10:05 am


This is automatically retrieved from the free shipping options that are setup in the WC Zones, done on line #26 of the snippet.

If you’re using the plugin the ‘Subtotal’ condition can be used to determine the current amount and setup your own message calculation with the minimum amount within there.


Judith May 17, 2021 at 4:43 pm

Thanks! worked perfectly, also for my multi-currency site! Appreciated!

Judith June 22, 2021 at 2:06 pm

Hi Jeroen,
Thanks for the snippet it works great. I have one contribution, to make the message translatable for those who run multilingual sites, the last piece of the code should simply be changed to this:

if ( $method->id == ‘free_shipping’ && ! empty( $min_amount ) && $cart_total < $min_amount ) {
$remaining = $min_amount – $cart_total;
wc_add_notice( sprintf ( __( 'Add %s more to get free shipping!'), wc_price( $remaining ) ) );

And then I have another question, if the customer empties the cart, the info message still displays "add % more to get free shipping!" with the minimum order amount getting displayed.

Can we change the snippet to include to check if the cart is empty and if empty not to display the message? I'm guessing that should be a simple filter to add but I lack the coding dexterity to make it work myself…. Thanks for your help!

Jeroen Sormani June 22, 2021 at 3:14 pm

Hi Judith,

Sure, this can be done by adding a additional check within the if-statement. Something like ‘ && $cart_total > 0’ will ensure the notice is only added when the cart is above $0.


Tim June 24, 2021 at 12:56 am

might there be an straight forward way to modify this function using a quantity total instead of amount totals?

Jeroen Sormani June 24, 2021 at 11:21 am

Hi Tim,

You should be able to use ‘WC()->cart->get_cart_contents_count()’ to call upon the quantity that is in the cart.


Judith September 6, 2021 at 2:35 pm

I have a few virtual products on my site, is there a way to not display the message when only virtual products are in the cart? Currently it doesn’t take this into account that virtual products don’t need any shipping fee (the checkout page correctly doesn’t add shipping but this message is still displayed…)

Jeroen Sormani September 6, 2021 at 4:30 pm

Hi Judith,

A additional check can be made with `WC()->cart->needs_shipping()` to see if there are shippable products in the cart.

Hope that helps you in the right direction.


Judith Kocken September 8, 2021 at 9:04 pm

Thanks that worked perfectly, I did it like this:

if ( ! is_cart() && ! is_checkout() || ! WC()->cart->needs_shipping() ) {

(I used || because with && it didn’t work for me)
Thanks a lot! I love your articles they’ve helped me a lot!

Piotr Szcześniak September 10, 2021 at 3:51 pm

Thank for this snippet! I have it used like below

if ( $method->id == ‘free_shipping’ && ! empty( $min_amount ) && $cart_total 0 ) {
$remaining = $min_amount – $cart_total;
wc_add_notice( sprintf( __(“Ajoutez %s d’achat afin d’obtenir la livraison gratuite!”), wc_price( $remaining ) ) );

if ( $method->id == ‘free_shipping’ && $cart_total == 0 ) {
$remaining = $min_amount – $cart_total;
wc_add_notice( sprintf( __(“Livraison gratuite à partir de %s d’achat.”), wc_price( $min_amount ) ) ); // Free shipping starts at $price

if ( $method->id == ‘free_shipping’ && $cart_total >= 50 ) {
$remaining = $min_amount – $cart_total;
wc_add_notice( sprintf( __(‘Félicitations! Vous profitez maintenant de la livraison gratuite!’) ) ); // Congratulations! You now have free shipping!

Daniel September 14, 2021 at 2:50 am

Great stuff! I really appreciate it. Would be nice if you post more of that snippets.

Raffo March 12, 2022 at 3:19 pm

hi Jeroen,
I have bought your advanced message plugin, I find it really handy, as I have 3 different free shippings and I can change them also within languages.
But I have a question, as I have made now my messages on cart are just standard text, can you suggest me a code ore an useful css to show them as in your image previews, I’d like to add that green V shaped badge or something similar with a background to make it more eye-catching

Jeroen Sormani March 14, 2022 at 11:13 am

Hi Raffo,

The green/checkbox in the screenshots are actually the default style of WooCommerce Core on one of the old twenty-{something} themes. Not something I have readily available to enter in the text.

This is a standard notice though, so your theme likely also has this styled a certain way that may be best fitting for your site.


Marijke Teirlinck March 19, 2022 at 12:08 pm


can i somehow add the code to the woocommerce_check out.
I would like to put the notice just under my delivery option.
Make sure they see the notice

Jeroen Sormani March 21, 2022 at 1:14 pm

Hi Marijke,

Natively in WooCommerce notices are displayed at the top of the page. A message like you’re describing may be done with the Advanced Messages plugin or a different kind of customization.


Leave a Reply