• Plugins
  • Support
  • Blog
  • About
  • FAQ
Menu
  • Plugins
  • Support
  • Blog
  • About
  • FAQ
$0.00 0 Cart

How to Display “Add $ X to cart and get free shipping” on Checkout

  • February 19, 2020
  • -
  • Lauri / WP Trio

Many stores have free shipping limit which gives free shipping to the customer when the cart subtotal exceeds certain amount. Free shipping limit is a great way to increase average order value. For example, if average order value is $ 75, you can try to set free shipping limit to $ 100 to increase AOV.

However, usually free shipping limit is not communicated clearly. If it’s only mentioned on the front page or in the terms and conditions, it’s likely the customer won’t see it in the first place.

Fortunately it’s easy to add “Add $ X to cart and get free shipping” message to the checkout with simple code. Here’s an example of the end result:

Example

Code

The code below adds the notice to the checkout. You can add the code with Code Snippets (recommended) or to functions.php file in the theme. You can change the limit on the line 9, by default it’s $ 50.

<?php
/**
 * Show free shipping limit notice on the checkout
 */
add_action( 'woocommerce_before_checkout_form_cart_notices', 'snippet_add_checkout_notice', 10, 0 );
function snippet_add_checkout_notice() {
	if ( is_checkout() && WC()->cart ) {
		$total = WC()->cart->get_cart_contents_total(); // Get cart subtotal after discounts
		$limit = 50.00; // Free shipping limit, change if necessary
		
		// If subtotal is less than limit, show notice
		if ( $total < $limit ) {
			// Calculate difference
			$diff = $limit - $total;
			$diff_formatted = wc_price( $diff );
			
			// Display notice
			wc_add_notice( sprintf( "Add %s to cart and get free shipping!", $diff_formatted ), 'notice' );
		}
	}
}

Latest Posts

How Stock Sync Pro Keeps Your Stock in Check
Product Sync vs. Stock Sync: Understanding the Differences
How to Add Payment Method Fee in WooCommerce
Version 2 of Stock Sync – Migration Guide
How to Display “Add $ X to cart and get free shipping” on Checkout

Plugins

WooCommerce Conditional Payments Pro
WooCommerce Conditional Shipping Pro
WooCommerce Product Sync Pro
WooCommerce Stock Sync Pro
30 DAY MONEY BACK GUARANTEE
+6000 HAPPY CUSTOMERS
SUPPORT FROM THE DEVELOPER

WP Trio / BitBot Oy
Flätbackantie 1, 04150 Sipoo
FINLAND
VAT ID: FI28269925

WP Trio

  • Support
  • Blog
  • About
  • FAQ
  • My account
  • Support
  • Blog
  • About
  • FAQ
  • My account

Plugins

  • Plugins
  • Docs
  • Plugins
  • Docs