• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

(REQUEST) Advanced Coupons

as alternative way you can use this free plugin

also you may use my snippet to show custom message
PHP:
add_action( 'woocommerce_before_cart', 'custom_coupon_messages' );
add_action( 'woocommerce_before_checkout_form', 'custom_coupon_messages' );
function custom_coupon_messages() {
    global $woocommerce;
    //Set coupon codes.
    $coupon_code = 'Your-Coupon-here';
    //Set coupon objects.
    $coupon_test = new WC_Coupon( 'Your-Coupon-here' );
    //Get the cart subtotal. Should return as a Double.
    $cart_subtotal = WC()->cart->subtotal;
    //If coupon test is passed add coupon.
    if ( $coupon_test->is_valid() && $woocommerce->cart->has_discount( $coupon_code ) ) {
        //Filter the coupon success message to display a custom message.
        add_filter( 'woocommerce_coupon_message', 'filter_woocommerce_coupon_message', 10, 3 );
        function filter_woocommerce_coupon_message( $msg, $msg_code, $instance ) {
            //Set a custom coupon message.
            $msg_code = 'case self::WC_COUPON_SUCCESS';
            $msg = __( 'Your message here!', 'your-theme-text-domain' );
            return $msg;
            return $msg_code;
            //Or return nothing (no message will be displayed - comment out the above/uncomment below).
            // return '';
        };
        //Print the above notice to screen.
        wc_print_notices();
    }
    elseif ( $cart_subtotal > 499 ) {
        //Print a notice (the blue boxed one)
        wc_print_notice( 'Spend $500 to qualify for the BIGLY YUGE discount!!!', 'notice' );
    }
}
 

Attachments

  • woocommerce-coupon-schedule.zip
    12.7 KB · Views: 19
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock