Support » Plugin: Currency Switcher for WooCommerce » Change currency by language change

  • Hello,
    I need a little help with my page.
    I have google translate installed and active and your plugin.
    How can I create the possibility the currency to be changed by language switching?
    For example, when I choose English , the currency to be automatically switched to $, if I choose German, the currency to be switched to euro and etc.
    I tried this :
    (I worked with the code for Gtranslate)
    Maybe it is not the correct article about the correct module?
    I guess I am not setting up some of the plugin settings right, too.
    Please , help !

Viewing 5 replies - 1 through 5 (of 5 total)
  • I saw my mistake.
    Wrong article.
    Now I checked this one:
    And followed the steps, but still, it’s not working when switching languages.
    Can you, please, asssit?

    Maybe it doesn’t work with Gtranslate but with another language plugin?

    Tried with Polylang.
    Seems that it’s not working again or I am not doing something correctly.

    Switched do Gtranslate.
    Hope to hear from you soon with some sort of a solution .
    Thank you.

    Try this code.

    add_filter('wp_head', function() {
        $lang = isset($_SERVER['HTTP_X_GT_LANG']) ? $_SERVER['HTTP_X_GT_LANG'] : '';
        switch ($lang)
            case 'en_GB':
                alg_wc_cs_session_set( 'alg_currency', EUR );
                alg_wc_cs_session_set( 'alg_currency', USD );

    But be sure to disable all sections related to currency selection in the plugin settings. Like set currency by locale or set currency by IP. You have to disable them to make this code work.

    • This reply was modified 7 months, 2 weeks ago by fkoomek.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change currency by language change’ is closed to new replies.