Repository Forums Support WooCommerce Extended Coupon Features PRO See the possibe free gift bevor reaching the minimum amount Reply To: See the possibe free gift bevor reaching the minimum amount

#4037
Soft79
Keymaster

The following snippet would add a message to the cart if a certain coupon is not applied. Replace ‘coupon_code’ by the actual coupon code and change the message to your needs…


add_action( 'woocommerce_after_cart_table', function() {
    if ( WC()->cart->has_discount( 'coupon_code' ) ) return;
    ?>
        <div class="soft79-notice clearfix">
            <p>Spend $ 60 to get a <strong>free gift</strong>!</p>
        </div>
    <?php
}, 5 );

Place it in your child theme’s functions.php.