Skip to content

Instantly share code, notes, and snippets.

@rwkyyy
Created February 16, 2022 15:14
Show Gist options
  • Save rwkyyy/33781b6fbb0fc560d82fa8cb877f26d5 to your computer and use it in GitHub Desktop.
Save rwkyyy/33781b6fbb0fc560d82fa8cb877f26d5 to your computer and use it in GitHub Desktop.
polylang + booster currency switcher - switch automatically on language change
//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