Help Center
Language / Currency Selectors
If you want a multi-language or multi-currency site you can add the selector element on the Header or Footer
But those switchers use the values from other plugins, they don’t make the translation or currency conversion on their own. Let’s see how to make them work.
Language Switcher
It requires a plugin, either Polylang https://wordpress.org/plugins/polylang/ or WPML https://wpml.org/
See this article Translate Content to multiple languages
Both plugins work fine with the theme, your choice depends on the amount of features you want and your experience or budget.
Check the details of each plugin and follow the plugin documentation to configure your language.
The only elements related to the theme are the selectors. You can insert the selectors on the Top Bar, Header, Footer and Off Canvas menus. The process is the same.
For example, in Appearance > Customize > Header > Top Bar add a new element to the desired section and select Language Selector.
All available locations:
- Top Bar. Go to Appearance > Customize > Header > Top Bar
- Main Header. Go to Appearance > Customize > Header > Header Layout (custom layout)
- Footer. Go to Appearance > Customize > Footer > Footer Bar
- Off-canvas Desktop. Go to Appearance > Customize > Header > Off-canvas Desktop
- Mobile menu. Go to Appearance > Customize > Header > Mobile Menu
Currency Switcher
This feature requires one of the following plugins:
- FOX – Currency Switcher Professional for WooCommerce https://wordpress.org/plugins/woocommerce-currency-switcher/
- Or WooCommerce Multilingual & Multicurrency with WPML https://wordpress.org/plugins/woocommerce-multilingual/
Just install the desired plugin and save your settings. Follow the plugin documentation.
Then go to the desired location and insert the Currency Selector
The available locations are the same ones as the Language Selector:
- Top Bar. Go to Appearance > Customize > Header > Top Bar
- Main Header. Go to Appearance > Customize > Header > Header Layout (custom layout)
- Footer. Go to Appearance > Customize > Footer > Footer Bar
- Off-canvas Desktop. Go to Appearance > Customize > Header > Off-canvas Desktop
- Mobile menu. Go to Appearance > Customize > Header > Mobile Menu
Troubleshooting
Prices not shown in the active currency with YayCurrency.
To show the correct currency add this snippet to wp-content/themes/goya-child/functions.php
use Yay_Currency\Helpers\YayCurrencyHelper;
use Yay_Currency\Helpers\FixedPriceHelper;
add_filter('goya_ajax_search_price', function($price_html,$product){
$price = $product->get_price();
$current_currency = YayCurrencyHelper::detect_current_currency();
$price_by_currency = FixedPriceHelper::product_is_set_fixed_price_by_currency($product,$current_currency);
if ($price_by_currency == false) {
$price_by_currency = YayCurrencyHelper::calculate_price_by_currency($price, false, $current_currency);
}
if ($price_by_currency > 0) {
$price = YayCurrencyHelper::format_price($price_by_currency);
}
return $price;
}, 10, 2 );
Code language: PHP (php)
It will show the custom price for single products or variable products where all variants have the same price.