Automatic matching of site language and Currency

I found a solution to this problem by redirecting the dropdown menu values to the main page of the site in that language. When the language and currency is selected on the button, the home page opens again with the relevant language and currency. Until the language is changed throughout the site, the product prices will appear in the new currency.
Hope it is useful.

First, add multilingual support and a currency converter to your site. Set the menus added to the header to be hidden in the properties panel.


Add to MasterPage.js code


import wixLocation from ‘wix-location’ ;

$w . onReady ( function () {
$w ( “#languageCurrency” ). onChange (( event ) => {
let url = $w ( ‘#languageCurrency’ ). value ;
wixLocation . to ( url ). target = “_blank” ;
});
});


Add a dropdown input field called “languageCurrency” in the Page Title section to select the language and currency.

Manage Options
Add Multiple Options
Paste the code below.

£ EN,https://www. yoursite .com/?lang=en&currency=GBP
$ EN,https://www.yoursite.com/?lang=en&currency=USD
€ DE,https://www.yoursite.com/?lang=de&currency=EUR
[u]₺ TR,https://www.yoursite.com/?currency=TRY[/u]
€ FR,https://www.yoursite.com/?lang=fr&currency=EUR
kr SV,https://www.yoursite.com/?lang=sv&currency=SEK

Don’t forget to change " yoursite ".com.
(Site native language:TR)

1 Like