Hello
An example:
add_filter('wp_head', function() {
global $WOOCS;
switch ($WOOCS->current_currency)
{
case 'USD':
//set language
break;
case 'EUR':
//set language
break;
default:
//set language
break;
}
});
How to set language please ask on WPML support
Thread Starter
free14
(@free14)
Thanks for your quick support. Yes I added hook from wpml and it started to switch language but not correctly. I think further questions for WPML. ))
add_filter(‘wp_head’, function() {
global $WOOCS;
switch ($WOOCS->current_currency)
{
case ‘USD’:
//set language
do_action( ‘wpml_switch_language’, ‘en’);
break;
case ‘EUR’:
//set language
do_action( ‘wpml_switch_language’, ‘de’);
break;
default:
//set language
do_action( ‘wpml_switch_language’, ‘ru’);
break;
}
});
Hello
yes, unfortunately, I cannot help with this
maybe you should change the hook “wp_head” – try to ask the hook that works during language switching
wp_head – It looks like this hook is executed late for language switching