Magento – Switch currency based on customer group

First, we have to get the user’s customer group and the current currency code.

So for example, if we have a customer groups naming “Euro” and “Yen” and we want to switch to their respective currencies, we will do it this way…

If the group name is “Euro”, then we have to set the target currency code to “EUR”. While If the group name is “Yen”, we have to set the target currency code to “JPY”.

But first, make sure that these currencies are enabled in the backend.
System > Configuration > Currency Setup > Allowed Currencies

To get currency codes.
System > Manage Currency > Rates

We have set the user currency based on the customer group, now have to check if the current store currency is the same as the user currency, if not, then we switch the currency.
The whole code should look like this: