I am using the below snippet to check the order total. If the total is less than 100, then the error message "click on coupon" must show, but if the total is zero(coupon applied) or 100 (to pay by credit card), then I want the if loop to end and allow checkout to complete. I have tried using break; and continue with else if, but I believe my syntax is wrong. This is what I have, where $minimum is 100:
if ( WC()->cart->total < $minimum1 ) {
if( is_cart() ) {
wc_print_notice(
sprintf( 'Click on a Coupon' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
} else {
wc_add_notice(
sprintf( 'Click on a Coupon' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
}
}
Aucun commentaire:
Enregistrer un commentaire