Skip to content

Instantly share code, notes, and snippets.

@goranefbl
Last active October 31, 2022 12:03
Show Gist options
  • Select an option

  • Save goranefbl/cd9ba7a5d6f6812ebb28308c6a8afcf9 to your computer and use it in GitHub Desktop.

Select an option

Save goranefbl/cd9ba7a5d6f6812ebb28308c6a8afcf9 to your computer and use it in GitHub Desktop.
remove coupon for specific user role
<?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