Created
February 16, 2022 15:14
-
-
Save rwkyyy/33781b6fbb0fc560d82fa8cb877f26d5 to your computer and use it in GitHub Desktop.
polylang + booster currency switcher - switch automatically on language change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//searched a lot for this, ended up coding it myself -- based on WOOCS and WPML. | |
add_filter('wp_head', function() { | |
$lang = get_locale(); | |
switch ($lang) | |
{ | |
case 'ro_RO': | |
wcj_session_set( 'wcj-currency', 'RON' ); | |
break; | |
case 'fr_FR': | |
wcj_session_set( 'wcj-currency', 'EUR' ); | |
break; | |
default: | |
wcj_session_set( 'wcj-currency', 'RON' ); | |
break; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment