Select Page

Add this to the functions.php file and then add the shortcode of [shippingleft] to get it to show up.

function how_much_shipping_is_left() {
   $min_amount = 100; //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!';
	  $notice = sprintf( '%s', $added_text );
      return $notice;
   } else {
	   $notice = "Order total is over £100 and shipping is free";
	   return $notice;
   } 
}
add_shortcode('shippingleft', 'how_much_shipping_is_left');