Menu Close

WooCommerce: “You Only Need $$$ to Get Free Shipping!” @ Cart


This is a very cool snippet that many of you should use to increase your average order value. Ecommerce customers who are near the “free shipping” threshold will try to add more products to the cart in order to qualify for free shipping. It’s pure psychology.

Here’s how we show a simple message on the WooCommerce Cart page. Enjoy!

WooCommerce: get free shipping if you add "x" money
WooCommerce: get free shipping if you add “x” money

PHP Snippet: Show Remaining Amount to Reach Free Shipping Threshold @ WooCommerce Cart

 * @snippet       $$$ remaining to Free Shipping @ WooCommerce Cart
 * @how-to        Get FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.9
 * @donate $9

add_action( 'woocommerce_before_cart', 'bbloomer_free_shipping_cart_notice' );
function bbloomer_free_shipping_cart_notice() {
   $min_amount = 50; //change this to your free shipping threshold
   $current = WC()->cart->subtotal;
   if ( $current < $min_amount ) {
      $added_text = 'Get free shipping if you order ' . wc_price( $min_amount - $current ) . ' more!';
      $return_to = wc_get_page_permalink( 'shop' );
      $notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), 'Continue Shopping', $added_text );
      wc_print_notice( $notice, 'notice' );
View Source
Posted in WooCommerce Tips