Posted on 07/03/2019 12:05:00
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