In WooCommerce è semplice aggiungere un avviso personalizzato sul carrello.
La soluzione è la seguente:
<?php
function my_custom_notice() {
if ( is_cart() ) {
$subtotal = WC()->cart->cart_contents_total + WC()->cart->get_taxes_total( false, false );
$free_shipping_threshold = 100;
if ( $subtotal < $free_shipping_threshold ) {
wc_add_notice( '<div class="alert">' . __( 'Spedizione gratuita oltre i 100 Euro', 'textdomain' ) . '</div>', 'notice' );
}
}
}
add_action( 'wp', 'my_custom_notice' );
?>