Support » Plugin: Currency Switcher for WooCommerce » How can I change currency based on current language on site

  • Hi there!
    I just installed this plugin and I must say I like it’s functionality very much!
    There’s just one thing I havent’ been able to figure out:
    I’m using Polylang in order to support two languages(pl_PL and en_US).
    I want an active currency to switch based on current language selected by user (PLN for polish, USD for english).
    If you could point out a function for switching active currency, I can do the rest.

    Thank you in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,
    Thanks 🙂

    There is a thing you can try.
    Have you tried playing with Languages section? It’s located on:
    – WooCommerce > Settings > Currency Switcher > Languages

    shrubberry

    (@shrubberry)

    Hi @karzin,
    Same question. Languages section is not working properly.

    Example:
    I set up plugin: locales for polish and english
    I clear all the cache.
    I run polish site. PLN. I switch to english (Polylang). Still PLN.
    I clear the cache. Still PLN.

    Funny thing:
    I change language in switcher to EUR.
    I clear all the cache.
    I run then polish site with clear url (no alg param). It’s EUR though default for polish is PLN and default for else than pl and eng is USD.
    Where does it even store? 🙂

    I would appreciate a helping hand in this. Or maybe there is any function like this one I can use? Cheers.

    fkoomek

    (@fkoomek)

    Hi.
    I am not developer, so I am not sure if this is the right solution, but seems like it’s working. I tried to went through the plugin files and came up with this:

    function setcurrency(){
    if ( !is_checkout() ) { /** exclude checkout page**/
    if (get_locale() == ‘pl_PL’) {
    alg_wc_cs_session_set( ‘alg_currency’, PLN );
    }
    else{
    alg_wc_cs_session_set( ‘alg_currency’, USD );
    }}
    }
    add_filter(‘wp_head’,’setcurrency’,99);

    It ties up selected language of site with certain currency. However, it isn’t possible to use switcher then. You can for example exclude Checkout page from this condition and put switcher there.

    fkoomek

    (@fkoomek)

    And be sure to disable locales and detection by IP sections in plugin settings.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can I change currency based on current language on site’ is closed to new replies.