Change Coupon message text(customize) when user is not logged-in
Instructions to customize the coupon message for users who are not logged in.
add_filter('woocommerce_coupon_message', function ($msg, $msg_code, $coupon){
if(!empty($coupon)){
if(method_exists($coupon, 'get_code') && function_exists('is_user_logged_in')){
$applicable_coupons = array('blackfridaysale'); //ENTER THE COUPON HERE WITH COMMA SEPARATED
$coupon_code = $coupon->get_code();
if(in_array($coupon_code, $applicable_coupons) && is_user_logged_in() !== true){
$msg = ''; //YOU CAN CUSTOMIZE THE MESSAGE HERE
}
}
}
return $msg;
} , 10, 3);