Answer the question
In order to leave comments, you need to log in
How to change product currency in another Wordpress language?
Hello.
How can I change the product currency in another language on Wordpress.
When I change the language of the site, the currency of the product should change.
How to do it?
Answer the question
In order to leave comments, you need to log in
What multilingual plugin are you using? What currency switch plugin are you using?
If 1 is wpml and 2 is woocommerce currency switcher then like this.
add_filter('wp_head', function() {
$lang = ICL_LANGUAGE_CODE;
global $WOOCS;
switch ($lang)
{
case 'bg':
$WOOCS->current_currency = 'BGN';
$WOOCS->storage->set_val('woocs_current_currency', 'BGN');
break;
case 'en':
$WOOCS->current_currency = 'EUR';
$WOOCS->storage->set_val('woocs_current_currency', 'EUR');
break;
default:
$WOOCS->current_currency = 'USD';
$WOOCS->storage->set_val('woocs_current_currency', 'USD');
break;
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question