I need to change the default currency in WooCommerce based on user roles in WordPress.
For the user role named “customer”, the default price needs to be in SEK and for all others the price must be in DKK
I’ve tried a lot of different solutions but can’t seem to find one that is working.
global $current_user;
if (in_array('customer', $current_user->roles)) {
Don't know what to put here.. :D
}
Right now i have no way of moving forward, can’t seem to find anything on Google or StackOverflow which helps my situation.
I can’t find a function that can change default currency programmaticly
2
Answers
You can use
woocommerce_currency
filterHi please check below code.
}