What are the benefits of online stores with many languages and currencies? Why do you need to create a Magento universal store? How can it improve your ecommerce business? Read this article and discover how to create Magento multi language and currency store views.
To attract a great number of international customers, you need to create a multilingual and currency ecommerce store. You will have better conversion rates and customer experience. Clients feel more confident and comfortable on a website without any barriers.
In this article, you will learn why your store needs to be universal. In addition, you will discover how to create Magento multi language and currency store views. Finally, you will find out the core features of the most popular Magento currency extensions.
Table of contents:
Why does your Magento store need to be multilanguage and multicurrency
How to change Magento 2 default language
How to create multi language website in Magento 2
How to set up multiple currency in Magento
How to change quote currency in Magento programmatically
How to set up currency when creating an order programmatically in Magento
How to create a custom currency in Magento programmatically
5 best Magento currency extensions
Why does your Magento store need to be multilanguage and multicurrency?
If you want to increase international sales, it’s highly recommended to provide a user-friendly, localized shopping experience. Customers are more likely to make a purchase if they are able to choose a language, currency, payment method, etc. So, in order to engage international clients experience, it’s essential to select the ecommerce platform that includes this complete package.
If you want to have a successful ecommerce business, you should take into account multi lingual and currency capabilities of your online store. In this case, you will be able to attract customers from different countries and increase conversion rates.
Let us consider the benefits of these capacities.
Magento multi language features
The main benefits of multilingual online stores websites :
- You are able to advertise your business in many countries and attract potential customers to your site.
- Such website can boost sales and conversions and create better relationships with existing and future customers.
- Native language search engines are more popular because customers feel more comfortable using their language.
Magento ecommerce platform gives you an opportunity to choose from a great number of languages. Every theme enables to integrate a multi-lingual storefront and allow the user to change languages without any problems.
Most of the Magento online stores have a single store view with one language. However, the platform offers multi language capabilities. In this case, a store should have multiple store views, which can help to make your online shop more convenient to use.
Partner With Us
Let's discuss how to grow your business. Get a Free Quote.Magento multicurrency features
Nowadays, most people prefer to shop online in their local currency. It makes them more confident to buy goods instead of dropping out. That’s why it’s better to choose ecommerce platform offering multi-currency support which gives many opportunities to merchants and customers.
It allows clients to pay for your products or services using the currency they prefer. Generally, international consumers have to pay in USD or Euros instead of their national currency. As a result, customers may be discouraged from making a purchase.
The main advantages of multi-currency support are:
- Avoiding extra charges and ensuring customer loyalty. This support helps the shopper avoid being charged extra fees for currency conversion on their credit card statements
- Pricing display consistency. Clients are able to see the pricing of your goods presented in a simple, rounded number (10 Euros).
- Payments via bank transfer. Customers are able to pay with alternative payment options.
- Reduce cart abandonment, refunds and chargebacks. This type of support decreases shopping cart abandonment and can reduce refund and chargeback rates. The prices are presented to clients using real-time foreign exchange rates.
So, offering customers multi currency capabilities is the right solution, which enhances their shopping experience and boosts international sales.
We described the most prominent features and you have learned about their benefits for ecommerce business. Now let’s find out how to work with Magento multi language and currency settings in the back office as well as how to perform a variety of multi-currency and language configurations programmatically.
Magento Development Services
Take your online store to the next level with BelVG Magento development
Visit the pageHow to change Magento 2 default language?
In Magento, both customer storefront and admin panel are by default in English. However, the platform has the number of in-built language packages and Magento multi language configurations allow store admins to set up different languages for customer side of the store and the back office in three simple steps.
How to enable Magento storefront language?
Step #1: navigate to Stores -> Settings -> Configuration.
Step #2: expand the General section and select Locale Options.
Step #3: in the Locale settings select the language you wish to apply to your storefront and press Save Config button.
How to enable Magento back office language?
Step #1: navigate to System -> Permissions -> All Users.
Step #2: select admin in the appeared list.
Step #3: in the Account Information section, select the language for your back office in the Interface Locale drop-down list.
Step #4: press the Save User button.
Done! We successfully changed the back office and storefront language settings. Now we will proceed to more advanced Magento multi language configurations.
Magento 2 Migration
Take your online store to the next level with BelVG Magento migration
Visit the pageHow to create multi language website in Magento 2?
In the previous paragraph, we changed the language settings for a Magento store with one store view. But what if you want your online shop to be multi-language? In Magento, the solution is quite simple. In order to make your Magento store multi language, you need to create as many store views as you want your store to have and assign each with a single language. This way, when your customer selects a certain language at the storefront, they are instantly redirected to the corresponding store view.
Below, you will find a step-by-step instruction on how to create multi language store in Magento.
Step #1: go to the Magento translation project and download the language package for your new store view.
Step #2: create the language folder at your Magento server and upload the language archive to it.
Step #3: log in to Magento back office and navigate to Stores -> Settings -> Configuration.
Step #4: expand the Store View drop-down and select Stores Configurations.
Step #5: press Create Store View button.
Step #6: complete the Store View Information settings:
- Store – to which store the newly created store view will belong to
- Name
- Code
- Status – Disabled or Enabled
- Sort Order – the position of the newly created store view among the other store views.
Step #7: press Save Store View when finished.
Step #8: go to the Dashboard and select the newly created store view.
Step #9: navigate to Store -> Settings -> Configuration and expand the Locale Options.
Step #10: select the language you wish to implement for this store view and press Save Config
Repeat the same course of actions to set up other languages for your multi language Magento store.
Partner With Us
Let's discuss how to grow your business. Get a Free Quote.How to create a Magento multilanguage attribute programmatically?
For the demonstration’s sake, we will create the ‘color’ attribute of a product in the English and German languages and attribute them to the corresponding EN and DE store views:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
public function addAttributeValue($arg_attribute) //$arg_attribute == 'color'; $color = $this->eavConfig->getAttribute('catalog_product', $arg_attribute); $options = []; $enValues = ['green'=>'Green', 'yellow'=>'Yellow']; $deValues = ['green'=>'Grün','yellow'=>'Gelb']; // const EN_STORE_ID == 1; // const DE_STORE_ID == 2; foreach ($enValues as $key => $value) { $options[$key]['attribute_id'] = $color->getId(); $options[$key]['value'][$key]['0'] = $value; $options[$key]['value'][$key][self::EN_STORE_ID] = $value; $options[$key]['value'][$key][self::DE_STORE_ID] = $deValues[$key]; foreach ($options as $option) { $this->eavSetup->addAttributeOption($option); |
We got the following result:
How to update Magento multilingual static blocks content programmatically?
Use the dependency injection in your module:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
public function __construct( \Magento\Cms\Model\BlockFactory $blockFactory $this->blockFactory = $blockFactory; Step #2: create a function to update some static blocks: /** * @param string $identifier * @param int $storeId * @param string $content */ public function updateCmsBlock($identifier, $storeId, $content) /** @var \Magento\Cms\Model\Block $block */ $block = $this->blockFactory->create(); $block->setStoreId($storeId)->load($identifier, 'identifier'); if ($block->getId()) { $block->setContent($content); try { $block->save(); } catch (\Exception $e) { echo $e->getMessage(); |
Which you can use:
1 2 3 4 |
$enStoreId = 1; $deStoreId = 2; $this->updateCmsBlock('my_custom_block', $enStoreId, 'new custom content EN'); $this->updateCmsBlock('my_custom_block', $deStoreId, 'new custom content DE'); |
As a result of our configurations, we get the following result:
How to set up multiple currency in Magento?
Step #1: log in to your Magento back office and navigate to Stores -> Settings -> Configuration.
Step #2: select Currency Setup in General and expand Currency Options tab.
Step #3: set up the Currency Options fields:
- Base Currency – the currency is used for all online payment transactions.
- Default Display Currency – in what currency is pricing displayed at your store.
- Allowed Currencies – the currencies accepted for payment at your store.
Step #4: expand the Catalog section, select Catalog and expand the Price section. Define whether the price configurations will apply globally or to the website.
Step #5: return to General and select Customer Setup. Expand the Fixer.io (or Webservicex) tab and set up the Connection Timeout in seconds.
Step #6: expand Scheduled Import Settings and set up such currency configuration fields as:
- Enabled – at Yes
- Service – select the rate provider
- Start time – the time after which rates will be updated
- Frequency – select from Daily, Weekly and Monthly
- Error Email Recipient – enter the email address of a person who will receive notification in case of an error
- Error Email Sender – set up the addresser of the error letter
- Error Email Template – select the letter template for error notification.
Step #7: press Save Config button in the upper right corner.
How to change quote currency in Magento programmatically?
Step #1: to perform this task, you need to create a module with the observer, for example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
app/code/BelVG/CartChange/etc/events.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="checkout_cart_product_add_after"> <observer name="change_cart" instance="Belvg\ChangeCart\Observer\ChangeCart" /> </event> </config> app/code/BelVG/CartChange/Observer/ChangeCart.php: <?php namespace Belvg\ChangeCart\Observer; use \Magento\Framework\Event\ObserverInterface; use \Magento\Checkout\Model\Session as CheckoutSession; use Magento\Quote\Model\QuoteRepository; class ChangeCart implements ObserverInterface { protected $checkoutSession; protected $quoteRepository; protected $storeManager; /** * @param CheckoutSession $checkoutSession * @param QuoteRepository $quoteRepository * @param \Magento\Store\Model\StoreManager $storeManager */ public function __construct( CheckoutSession $checkoutSession, QuoteRepository $quoteRepository, \Magento\Store\Model\StoreManager $storeManager) $this->checkoutSession = $checkoutSession; $this->quoteRepository = $quoteRepository; $this->storeManager = $storeManager; /** * @param \Magento\Framework\Event\Observer $observer * @throws \Exception */ public function execute(\Magento\Framework\Event\Observer $observer) $quote = $this->checkoutSession->getQuote(); $targetCurrencyCode = 'EUR'; $this->storeManager->getStore()->setCurrentCurrencyCode($targetCurrencyCode); $quote->setQuoteCurrencyCode($targetCurrencyCode); $quote->collectTotals(); $this->quoteRepository->save($quote); } |
Step #2: use any event, for example, checkout_cart_product_add_after (as in the example) or from list:
Here is the result of code execution after event dispatching. We’ve changed the currency from bitcoin(BTC) to Euro(€):
Magento 2 Integration
Take your online store to the next level with BelVG Magento integration
Visit the pageHow to set up currency when creating an order programmatically in Magento?
There are two common ways of creating an order – using API, or programmatically, with code. In this article, we will address the second and most popular way.
Below you will find the example of the Magento extension that we created to suit our purposes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
app/code/Belvg/CreateOrder/etc/di.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Framework\Console\CommandList"> <arguments> <argument name="commands" xsi:type="array"> <item name="create_new_order" xsi:type="object">Belvg\CreateOrder\Console\Command\CreateOrder</item> </argument> </arguments> </type> </config> app/code/Belvg/CreateOrder/Console/Command/CreateOrder.php: <?php namespace Belvg\CreateOrder\Console\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\ObjectManagerInterface; class CreateOrder extends Command { protected $appState; protected $_objectManager; protected $storeManager; protected $customerFactory; protected $customerRepository; protected $product; protected $quote; protected $currencyFactory; public function __construct( \Magento\Framework\App\State $appState, ObjectManagerInterface $_objectManager, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, \Magento\Quote\Model\QuoteFactory $quote, \Magento\Catalog\Model\Product $product $this->appState = $appState; parent::__construct(); $this->_objectManager = $_objectManager; $this->storeManager = $storeManager; $this->customerFactory = $customerFactory; $this->customerRepository = $customerRepository; $this->quote = $quote; $this->product = $product; $this->currencyFactory = $currencyFactory; protected function configure() $this->setName('belvg:create_new_order')->setDescription('Creates new order'); parent::configure(); protected function execute(InputInterface $input, OutputInterface $output) try { $this->appState->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); } catch (\Magento\Framework\Exception\LocalizedException $exception) { echo $exception->getMessage(); $output->writeln('Creating new order'); $this->createOrderAtMage( ['currency_id' => 'USD', 'shipping_address' => ['firstname' => 'John', 'lastname' => 'Doe', 'street' => 'xxxxxx', 'city' => 'xxxxxxx', 'country_id' => 'US', 'region_id' => 'xxxxx', 'postcode' => '85001', 'telephone' => '52556542', 'fax' => '3242322556', 'save_in_address_book' => 1], 'items' => [ ['product_id' => '1', 'qty' => 1, 'price' => 20.00], ['product_id' => '2', 'qty' => 2, 'price' => 30.00]] ]); public function createOrderAtMage($order) $store = $this->storeManager->getStore(); $websiteId = $this->storeManager->getStore()->getWebsiteId(); $customer = $this->customerFactory->create(); $customer->setWebsiteId($websiteId); $customer->loadByEmail($order['email']); // load customet by email address if (!$customer->getEntityId()) { //If not avilable then create this customer $customer->setWebsiteId($websiteId)->setStore($store)->setFirstname($order['shipping_address']['firstname'])->setLastname($order['shipping_address']['lastname'])->setEmail($order['email'])->setPassword($order['email']); $customer->save(); $quote = $this->quote->create(); // Create Quote Object $quote->setStore($store); // Set Store //Here code for change currency for order: $storeId = 1; $currencyCode = 'BTC'; $currency = $this->currencyFactory->create()->load($currencyCode); $this->storeManager->getStore($storeId)->setCurrentCurrency($currency); $customer = $this->customerRepository->getById($customer->getEntityId()); $quote->setCurrency(); $quote->assignCustomer($customer); // Assign quote to Customer foreach ($order['items'] as $item) { $product = $this->product->load($item['product_id']); $product->setPrice($item['price']); $quote->addProduct($product, intval($item['qty'])); $quote->getBillingAddress()->addData($order['shipping_address']); $quote->getShippingAddress()->addData($order['shipping_address']); $shippingAddress = $quote->getShippingAddress(); $shippingAddress->setCollectShippingRates(true)->collectShippingRates()->setShippingMethod('freeshipping_freeshipping'); $quote->setPaymentMethod('checkmo'); $quote->setInventoryProcessed(false); $quote->save(); $quote->getPayment()->importData(['method' => 'checkmo']); $quote->collectTotals()->save(); $orderData = $this->_objectManager->create('\Magento\Quote\Model\QuoteManagement')->submit($quote); if ($orderData->getEntityId()) { $result['order_id'] = $orderData->getRealOrderId(); } else { $result = ['error' => 1, 'msg' => 'Your custom message']; return $result; } |
Here is the result of the module operation:
Partner With Us
Let's discuss how to grow your business. Get a Free Quote.How to create a custom currency in Magento programmatically?
Step #1: create a model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
app/code/Belvg/ChangeCart/Model/Config/AddCurrencies.php: <?php namespace Belvg\ChangeCart\Model\Config; use Magento\Framework\Locale\Bundle\CurrencyBundle; class AddCurrencies extends \Magento\Framework\Locale\TranslatedLists { public function getNewCurrencies() return [ ['value' => 'LTC', 'label' => 'Litecoin'], ['value' => 'BTC', 'label' => 'Bitcoin'], ['value' => 'ETH', 'label' => 'Etherium'], ]; /** * @return array */ public function getOptionAllCurrencies() $currencyBundle = new \Magento\Framework\Locale\Bundle\CurrencyBundle(); $locale = $this->localeResolver->getLocale(); $currencies = $currencyBundle->get($locale)['Currencies'] ?: []; $options = []; foreach ($currencies as $code => $data) { $options[] = ['label' => $data[1], 'value' => $code]; $options = array_merge($options, $this->getNewCurrencies()); return $this->_sortOptionArray($options); /** * @return array */ public function getOptionCurrencies() $currencies = (new CurrencyBundle())->get($this->localeResolver->getLocale())['Currencies'] ?: []; $options = []; $allowed = $this->_config->getAllowedCurrencies(); foreach ($currencies as $code => $data) { if (!in_array($code, $allowed)) { continue; $options[] = ['label' => $data[1], 'value' => $code]; $options = array_merge($options, $this->getNewCurrencies()); return $this->_sortOptionArray($options); } |
Step #2: add preference to di.xml:
1 2 3 4 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Framework\Locale\TranslatedLists" type="Belvg\ChangeCart\Model\Config\AddCurrencies" /> </config> |
Step #3: clear cache and remove
1 |
/generated/code and /generated/metadata. |
Step #4: navigate to Store -> Configuration -> Advanced -> System -> Currency, select and save newly installed currencies:
Step #5: go to Store -> Configuration -> General -> Currency Setup and add new currencies to Allowed currencies list:
Step #6: add the symbols to your currencies (Stores->Currency Symbol) and install the appropriate provider to retrieve currency rates:
After you have performed the steps described above, you will see a similar result in the database:
It is also possible to set currency rates to use new currencies:
You can see new currencies in the selector on frontend:
5 best Magento currency extensions
Magento ecommerce platform offers a great variety of extensions. We have chosen Top 5 Magento extensions and now we are going to tell about their core features and compare prices.
Auto Store & Currency Switcher. This extension offers a localized and personalized shopping experience. The Switcher gives customers the opportunity to see prices and pay in the currency based on their geographic location. In addition, it helps get the global audience for your online store and sell your goods all over the world. If you have a large business and international customers with various languages and currencies, it is important for clients to see the correct currency and store view.
Compatibility: Community 2.1
Price: $129
Store & Currency AutoSwitcher. Do you want to bring to a new level your Magento 2 Store and have excellent many-lingual and i-currency capabilities? Then, you need Store and Currency Auto Switcher. This extension automatically redirects clients to localized stores and switches to their currencies. In addition, using the geo-targeting option enables you to change the language depending on the customers’ region. So, if you want to increase sales and ensure customer trust, take advantage of Store & Currency AutoSwitcher.
Compatibility: Community 2.0, 2.1, 2.2, Enterprise 2.0, 2.1, 2.2
Price: $149
Currency Rate Updater. Do you need a simple and fast currency converter that will keep the exchange rates of your site’s currencies up to date? Currency Rate Updater may help you. It offers a list of updated currency rates, from which you are able to choose and convert any currency, on the click of one button.
So, using this extension, the store owner can always get the latest currency rate. Moreover, it is really useful for scheduled currency exchange rate import and enables a storekeeper to get an “Hourly, Daily, Monthly and Yearly” currency rate.
Compatibility: Community 2.0, 2.1, 2.2
Price: $30.
Auto Currency Switcher. In ecommerce business, you may come across the following situation: a customer from one country wants to buy some goods from another region. However, paying in different currencies is more expensive than in local ones and leads to conversion rates decrease. There is a good solution to this problem – Auto Security Switcher.
This extension allows you to track the visitors’ IP address automatically, display and convert prices for the customers in their currency. In addition, it is useful for store owners who sell globally. They can automatically display product prices for US residents in USD, for British in Pounds, etc. Another competitive advantage is that Auto Security Switcher has “IP Address To Country” functionality. So, store owners don’t need to install any additional software to identify the customers geographic location.
Compatibility: Community 2.1, 2.2
Price: $69.
PayPal Multi Currency. Do you want to provide customers with a better user experience and enjoy accepting payments in their preferred currency? Then, PayPal Multi Currency is exactly what you need. This extension allows clients to pay via PayPal Express in their selected currency without changing back to the store’s base currency. Using PayPal Multi Currency, global customers won’t have any problems with a payment process. This extension supports various currencies for payment to use with PayPal Express. Moreover, it accepts payments in the preferred currency from the global customers. So, choosing this extension, you will be able to deliver enhanced customer experience.
Compatibility: Community 2.2
Price: $49
Wrapping it up
We hope this article was useful and helpful for Magento store owners who are interested in improving their ecommerce business and want to provide a user-friendly, localized shopping experience.
It is essential to take into account multi lingual and currency capabilities of your store in order to attract international customers and increase conversion rates. In addition, you expand your target audience, improve customer experience and put their needs first.
Moreover, even if English is recognized as a global language, you can always use a little extra localization in order to obliterate any language and currency barriers.
After studying our comprehensive Magento guide, you are able to create Magento multi language store view and currency store view. In addition, you have learned about best rated Magento currency extensions and can choose the most suitable ones for your online store.
If you have any questions, feel free to share comments.
Magento Development Services
Take your online store to the next level with BelVG Magento development
Visit the page