This guide shows you how you how to show a banner on your WooCommerce site based on the cart total. In our example, we show a banner letting the customer know their cart total is over 2K therefore qualifying for free shipping. This guide be used to show any banner message you like whether it’s shipping related or not. Simply change the threshold to your desired amount as well as the message and formatting of the banner as necessary.
/**
* Snippet Name: WooCommerce Banner Based On Cart Total
* Snippet Author: ecommercehints.com
*/
add_action( 'wp_head', 'ecommercehints_cart_total_based_banner' );
function ecommercehints_cart_total_based_banner() {
$order_total = WC()->cart->subtotal;
if ( $order_total > 2000 ) { // The threshold for the banner to appear ?>
Your order is over 2K, you qualify for free shipping!