Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionIs it possible to filter available payment methods to certain user roles just using the WooCommerce configuration? Without adding anything to any template file I mean. What I want to achieve is to give the possibility to pay with credit card only to certain users.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionIs it possible to filter available payment methods to certain user roles just using the WooCommerce configuration? Without adding anything to any template file I mean. What I want to achieve is to give the possibility to pay with credit card only to certain users.
Share Improve this question asked Jun 20, 2017 at 8:39 SergiSergi 2601 gold badge6 silver badges18 bronze badges2 Answers
Reset to default 9It is not possible by WooCommerce default configuration.
You have to install below plugin.
https://codecanyon/item/woocommerce-role-based-payment-shipping-methods/18953727
or programmatically, you can refer below link.
https://businessbloomer/disable-payment-gateway-specific-user-role-woocommerce/
You can use following:
add_filter('woocommerce_available_payment_gateways', 'filter_gateways', 1);
function filter_gateways($gateways)
{
$current_user = wp_get_current_user();
$role = $current_user->roles;
global $woocommerce;
/* add your user role in condition and payment method which you need to unset*/
if ($role[0] == 'administrator') {
unset($gateways['cod']);
}
return $gateways;
}