0

If all my customers had a custom field containing either 'GBP' or 'EURO' for example, is it possible for the store to switch currency based on this custom field value once they login?

So EURO customers see Euro pricing, and GBP see GBP pricing.

1
  • use : Mage::app()->getStore()->setCurrentCurrencyCode('USD'); Mage::app()->getStore()->setCurrentCurrencyCode('GBP'); base on condition – Nikunj Vadariya Oct 21 '16 at 10:17
1

You can define an observer on controller_action_layout_render_before and have something like this:

function controllerActionLayoutRenderBefore($observer)
{ 
    if(!Mage::getSingleton('customer/session')->isLoggedIn()) return;

    $customer = Mage::getSingleton('customer/session')->getCustomer();
    $currency = $customer->getData('my_currency_attribute');

    if (!empty($currency))
       Mage::app()->getStore()->setCurrentCurrencyCode($currency); 
}

Given that the value of your attribute matches EXACTLY the available currency codes (in your example it should EUR instead of EURO)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.