Developer forum

Forum » Development » Currency per language site

Currency per language site

Ivan Marijanović
Ivan Marijanović
Reply

Hi there!

When user visits page is there a way to check if currency is set to appropriate value and if it is not to change it.

For example we have a site which starts with eng. and it should have USD currency and can I check if it is usd and if it is not to change currrency on fly?

Ivan


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Ivan,

You should consider using the Website Settings to specify your currencies. That way, Dynamicweb will handle setting the currency for you.

That said, you can use the API to check which currency is currently set. The property Dynamicweb.Ecommerce.Common.Context.Currency will give you that information. In your use-case, it sounds like you should check this in your template and change the currency if needed. Be aware that you're changing the currency at a late stage in the rendering process and certain calculations have been performed using the incorrect currency, so you should reload the page. Alternatively, if you don't want to set the currency directly using the property, you can use the querystring parameter "CurrencyCode". Reloading the page with "&CurrencyCode=USD" will also set the currency. Please note, that this will lock this currency for that user. If they switch website, they will keep the currency that you specified. Using the property does not have this behavior.

- Jeppe

Votes for this answer: 1

 

You must be logged in to post in the forum