Woocommerce – Calculate Remaining spend for free delivery

WooCommerce Free Delivery Calc

If you’re a Digital Business Analyst, this idea will wow your stakeholders.

Why?

Because it will ensure ALL their online customers see how much they have to offer in their store. And increase their average order value by telling their customers how much more they need to spend to qualify for FREE DELIVERY

I created this code myself, but if you’re not into the techie side, you can work closely with your developer and designer to make the banner look and feel the way you wish.

 

It will look a little bit like this:

Woocommerce Calculate Delivery AR Coffee
The code in the box below needs adding to the wp-content/themes/[your theme]/header.php file

The code in the box below needs adding to the 
$subtotal = WC()->cart->subtotal;
$free_shipping_settings = get_option( 'woocommerce_free_shipping_settings' );
$min_amount = $free_shipping_settings['min_amount'];
$remaining = $min_amount - $subtotal;

if ($subtotal > 0) { ?>
<div class="store-bar"> <?php
echo 'Get FREE delivery if you spend another £';
echo $remaining;
<a href="<?php echo home_url();?>/shop"><b>  SEE OFFERS >> </a>

}
?>
</div>

Place the above code after the navigation block of code (shown below):


<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse navbar-ex1-collapse',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
</div>
</nav><!-- .site-navigation -->

 

And before the ‘content’ block of code (shown below):


<div id="content" class="site-content container"><?php
global $post;

2 thoughts on “Woocommerce – Calculate Remaining spend for free delivery

Leave a Reply

Your email address will not be published. Required fields are marked *