Last active
October 31, 2022 12:03
-
-
Save goranefbl/cd9ba7a5d6f6812ebb28308c6a8afcf9 to your computer and use it in GitHub Desktop.
remove coupon for specific user role
This file contains hidden or 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 | |
| add_filter('gens_raf_should_remove_coupon','gens_raf_code',10,3); | |
| function gens_raf_code($should_remove,$guest_coupon_code,$referrer_id) { | |
| if( is_user_logged_in() ) { | |
| $user = wp_get_current_user(); | |
| $roles = ( array ) $user->roles; | |
| if($roles[0] === "wholesale-customer") { | |
| return true; | |
| } | |
| } | |
| return $should_remove; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment