How can i switch between countries in Tea commerce?
Hi
I was working on a project with multiple cultures and countries, When I tried to switch culture from da-DK to en-US all the Prices, Currencies, and VAT of the cart items must be changed from DKK to USD which is set in the backend.
But I can see that all of the properties didn't switch properly.
I can see the VAT rate changed from 25,00% (of da-DK) to 20.00% (en-US) but is displaying in a danish culture 20,00
Could you please help?
Can you share what code you are currently using to "switch the culture"? I should be able to suggest something once I know what you are currently doing.
No, those are essentially setting the billing / shipping address regions of your order. They have no effect on the order culture.
You can change an individual orders currency by calling
order.ChangeCurrency(currencyId);
I believe this should then force the prices to recalculate when the order is saved.
PS TC.SetCurrentCurrency(storeId, currencyId); will call order.ChangeCurrency(currencyId) under the hood. The difference is, TC.SetCurrentCurrency will set the current session currency, so any new orders created will automatically be in that currency from that moment on, where as order.ChangeCurrency only changes the currency of that one order with the currency sessions default currency being unchanged.
How can i switch between countries in Tea commerce?
Hi
I was working on a project with multiple cultures and countries, When I tried to switch culture from da-DK to en-US all the Prices, Currencies, and VAT of the cart items must be changed from DKK to USD which is set in the backend.
But I can see that all of the properties didn't switch properly. I can see the VAT rate changed from 25,00% (of da-DK) to 20.00% (en-US) but is displaying in a danish culture 20,00
Could you please help?
Hey Arun,
Can you share what code you are currently using to "switch the culture"? I should be able to suggest something once I know what you are currently doing.
Matt
I'm not sure. Can you please share which are codes used in Tea Commerce to switch currency and culture?
To set the current sessions currency you would use
See https://docs.teacommerce.net/3.4.0/api/currency/#getcurrentcurrency for more details.
We don't control the session culture change, hence why I asked what code you were using so I could suggest how to integrate the code above.
Matt
Do this code affect culture for items in the order?
order.ChangePaymentRegion(country.Id, null); order.ChangeShippingRegion(country.Id, null);
order.Save();
Hi Arun,
No, those are essentially setting the billing / shipping address regions of your order. They have no effect on the order culture.
You can change an individual orders currency by calling
I believe this should then force the prices to recalculate when the order is saved.
PS
TC.SetCurrentCurrency(storeId, currencyId);
will callorder.ChangeCurrency(currencyId)
under the hood. The difference is,TC.SetCurrentCurrency
will set the current session currency, so any new orders created will automatically be in that currency from that moment on, where asorder.ChangeCurrency
only changes the currency of that one order with the currency sessions default currency being unchanged.is working on a reply...