Learn how to implement a currency switcher in Umbraco Commerce.
In a globalized world, it is essential to provide users with the ability to switch between different currencies. This feature is especially important for e-commerce websites that cater to customers from different countries.
In this guide, you can learn how to implement a currency switcher in Umbraco Commerce.
In this guide, it is assumed that each country has a single currency. If your store supports multiple currencies per country, you must adjust the implementation accordingly.
Configure Countries and Currencies
Define the countries and currencies you want to support, in the Umbraco backoffice.
Countries
Currencies
Navigate to the Content section.
Populate the product prices for each currency.
Product Prices
Create a Currency Switcher Component
A partial view is used on the frontend to allow users to toggle between existing currencies.
Currency Switcher
This is done by creating a CurerrencySwitcher.cshtml partial with the following implementation:
Result
With the currency switcher implemented, users can switch between countries/currencies on your website.
The changes are reflected on the product details pages.