Switch currency depending on a specific user role
-
I need to change the currency depending on a specific user role. I want to change the currency to EUR for customers who are defined as user role EU paying and those who are customers to still be able to pay in GBP.
I have this code and I’ve used $WOOCS->set_currency(‘EUR’) but it doesn’t seem to change the currency. Any help will be appreciated.
add_filter(‘woocommerce_currency’, ‘set_role_currency’, 100);
function set_role_currency($currency){
global $current_user;if (in_array(‘eu_paying’, $current_user->roles)) {
global $WOOCS;
$WOOCS->set_currency(‘EUR’);
return ‘EUR’;
}
return $currency; //return your woocommerce default currency
}`
The topic ‘Switch currency depending on a specific user role’ is closed to new replies.