Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author RealMag777

    (@realmag777)

    Hello

    You can use shortcodes: http://currency-switcher.com/documentation/#!/section_3 which should appears always not depending of any language

    <?php echo do_shortcode('[woocs]'); ?>

    I don’t know how geolocation is correct, if I can count with that feature http://currency-switcher.com/using-geolocation-causes-problems-doesnt-seem-to-work-for-me/

    Thread Starter iksivee

    (@iksivee)

    I mean when someone change translation via Polylang switcher. For expample to US English, I want to automatically switch currency to dollar.

    Plugin Author RealMag777

    (@realmag777)

    Hello

    I think it is possible with little custom script in header.php of current wp theme:

    $lang = _GET_CURRENT_LANG_BY_POLLY_API__;
    global $WOOCS;
    switch($lang){
       case 'us':
          $WOOCS->current_currency='USD';
          $WOOCS->storage->set_val('woocs_current_currency', 'USD');
       break;
     case 'ca':
          $WOOCS->current_currency='CAD';
          $WOOCS->storage->set_val('woocs_current_currency', 'CAD');
       break;
      default:
          $WOOCS->current_currency='EUR';
          $WOOCS->storage->set_val('woocs_current_currency', 'EUR');
      break;
    }

    I hope you understood idea
    all country codes in ‘case’ should be checked for Polly compatibility, I wrote it from my head …

    Thread Starter iksivee

    (@iksivee)

    Thank you for your help.
    I think, I have problem with language code. I tried: case ‘en’
    I have this language in polylang translation, but it doesn’t work. It will go to default section of code.

    Thread Starter iksivee

    (@iksivee)

    I found solution:
    $lang = _GET_CURRENT_LANG_BY_POLLY_API__;
    this not work for me, but this is ok 🙂

    $lang=get_locale();
    and case form: ‘cs_CZ’

    Plugin Author RealMag777

    (@realmag777)

    Great, thank you for cooperation 😉

    Hey, Guys
    I would really appreciate it if you can summurize the code you used !
    I have been bumping into this topic for 2 weeks now and I am still wondering how to get this – now I see you managed to do it.

    Did you put this in the header.php or functions.php.? What is the code you used?

    I would really appreciate it/
    THank you!

    OK- got it work within the header.php in my chil theme

    <?php
    $lang=get_locale();
    global $WOOCS;
    switch($lang){
     case 'bg_BG':
          $WOOCS->current_currency='BGN';
          $WOOCS->storage->set_val('woocs_current_currency', 'BGN');
       break;
     case 'en_GB':
          $WOOCS->current_currency='EUR';
          $WOOCS->storage->set_val('woocs_current_currency', 'EUR');
       break;
      default:
          $WOOCS->current_currency='EUR';
          $WOOCS->storage->set_val('woocs_current_currency', 'EUR');
      break;
    }
    ?>

    Hope this helps others

    Cheers and thank you very much to both of you!

    Plugin Author RealMag777

    (@realmag777)

    @maria7610

    Hello Maria

    Thank you for cooperation 😉

    djhackraj

    (@djhackraj)

    please help me for google translate…
    https://wordpress.org/plugins/google-language-translator/

    Plugin Author RealMag777

    (@realmag777)

    @djhackraj

    And how can I help you?

    djhackraj

    (@djhackraj)

    how to connect this plugin to Your currency switcher

    Plugin Author RealMag777

    (@realmag777)

    @djhackraj

    What do you mean under connection? maria7610 provided above good script to show currencies if change language in polly
    +
    If you mean translation: you can create *.po files here https://www.icanlocalize.com/tools/php_scanner for translation, but there is no words on the front

    @maria7610

    Thanks!

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Switch currency with language change – polylang’ is closed to new replies.