Changing a user locale (currency) programmatically

Maros Takac1
Tera Contributor

Hello Gurus,

I have a requirement to change a user currency within an existing session without having to log out.

Currently, when i change a country code on a user profile and refresh the entire site/page, no change takes place meaning that I see catalog item prices in the same currency, though technically prices should be shown in a new currency -> I suppose a session object does not notice of this change ?.

However, when i log out and log back in, the system shows prices in a correct currency...

with that said, is there a way to accomplish the above without having to log out??

Many thanks

Cheers

Maros

2 REPLIES 2

divya mishra
Tera Guru

Hey Maros,



As rightly observed by you the changes in the country code would do the trick. But here the catch is the user session that still prevails when a user refreshes his/her page.



Therefore, in order to apply the changes in the instance and breakdown the user session one must need to log out.



Please Hit ✅Correct, ��Helpful, or ��Like depending on the impact of the response


Have a lovely day ahead




Regards,


Divya Mishra


Hello Divya,



thank you for your comment.



I am looking for a setter method on the session object, which will allow me to overwrite an existing locale setting, mainly a country code as that determines what currency is used to display prices.



Cheers


Maros