Last active
March 18, 2019 09:12
-
-
Save benoitmercusot/9ca6595f8cecd530e3a279887c901ab6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Le filtre est appliqué dans class-wc-coupon.php | |
add_filter('woocommerce_coupon_is_valid', 'happy_hour_coupon_validity', 10, 2 ); | |
function happy_hour_coupon_validity( $valid, $coupon ){ | |
if( $coupon->code=='happyhour' && $valid == true ){ | |
if( date('G') > 16 && date('G') < 21 ) | |
return true; | |
return false; | |
} | |
return $valid; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment