Change WordPress user roles and capabilities › Forums › How to or FAQ › Restrict Role from Processing Refunds in WooCommerce › Reply To: Restrict Role from Processing Refunds in WooCommerce
14/09/2016 at 03:58
#2734
Vladimir
Keymaster
You have to call current_user_can()
for every role you wish to check, e.g.:
if (current_user_can('role_1') || current_user_can('role_2')) {
...
}
This means “if current user have role_1 or current user have role_2”.
For our code:
if (!current_user_can('sales') && !current_user_can('shipping')) {
return;
}
That is ‘do not execute code below if user does not have role ‘sales’ and user does not have role ‘shipping’.