PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Cart Currency Problem

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
12

I'm having problems with currency. When adding products to cart and changing language from Danish to English the problem accours.

When viewing the cart prices and subtotal are displayed in DKK (previous selected language) and not EURO as the selected language.

It seems like the off-canvas cart is cached or fixed in currency?

https://gallerifusion.dk/

I have updated the"Private data for this topic" with login details for further investigation.

Have a nice day.

Hello

My plugin does not have functionality for switching currencies depending on the language

What plugin version number are you using?

Hello,

I am using version 1.4.1.3 and TranslatePress. When changing language from Danish and English and viewing cart items. Their currency is shown in the opposite languages currency (DKK) and not in EURO (English).

Please watch video for documation: https://youtube.com/shorts/_qTOflki1c0?feature=share

Hello

I saw the video! But my plugin does not have functionality for switching currencies depending on the language. This is a third party functionality

What do you use to switch currencies?

Hello,

I am confused with your anwser. I thought that was what your plugin is doing for multilangual sites as mine http://www.gallerifusion.dk/kunst/.

I'm using FOX - Currency Switcher and TranslatePress for translation and currency display.

I have added your custom javascript to my functions.php for your plugin to work with TranslatePress language switcher: https://currency-switcher.com/switch-currency-with-language-change

But it's not working perfect when adding product to cart and then switching language as it shows previous selected currency and not the current currency. Hope you understand and thanks for your time!

Hello

https://currency-switcher.com/switch-currency-with-language-change - These are recommendations for implementing a custom method for switching currencies. this code is not part of our plugin. And I wrote this because I don’t know how you implemented this functionality

the shopping cart on your website is also a third-party functionality (not native woocommerce)

Possible reason for this behavior: third-party cart functionality takes data before this code switches currencies

In this case, you can try changing the hook - wp_head   to  get_header  OR wp_enqueue_scripts

 

 

Hi,

Thanks for you response.

Im not talented with configuring javascript sadly. Can you or someone else help me implement this?

Hello

Ok! Please  drop   me the code you used for this functionality.

Can you write where you inserted this code?

Hello Pablo,

Thank you so much!

I'm using TranslatePress for language and FOX - Currency Switcher for currency.

I have used coode from this documentation and edited it to my needs: https://currency-switcher.com/switch-currency-with-language-change

add_filter('wp_head', function() { // TranslatePress/Currency Switcher
    $lang = get_locale();
    global $WOOCS;
    switch ($lang)
    {
        case 'en_GB':
            $WOOCS->set_currency('EUR');
            break;
        default:
            $WOOCS->set_currency('DKK');
            break;
    }
} );

The code is placed inside my OceanWP child theme functions.php file. My logins are shared in "Private data for this topic" section if needed.

Above is my reply :)

Please  try this  code:

add_filter('get_header', function() { // TranslatePress/Currency Switcher
    $lang = get_locale();
    global $WOOCS;
    switch ($lang)
    {
        case 'en_GB':
            $WOOCS->set_currency('EUR');
            break;
        default:
            $WOOCS->set_currency('DKK');
            break;
    }
} );
OR
add_filter('wp_enqueue_scripts', function() { // TranslatePress/Currency Switcher
    $lang = get_locale();
    global $WOOCS;
    switch ($lang)
    {
        case 'en_GB':
            $WOOCS->set_currency('EUR');
            break;
        default:
            $WOOCS->set_currency('DKK');
            break;
    }
} );

Hi Pablo,

It still doesn't work. I've tried with both codes you suggested. Can you try again?

Nina Kleivan Moderne Oliemaleri | GALLERI FUSION

Documentation:

https://gallerifusion.dk/wp-content/uploads/2023/10/2023-10-13-11_32_09-Nina-Kleivan-Moderne-Oliemaleri-_-GALLERI-FUSION-Personal-Microsoft​-Edge.png

https://gallerifusion.dk/wp-content/uploads/2023/10/2023-10-13-11_32_21-Nina-Kleivan-Moderne-Oliemaleri-_-GALLERI-FUSION-Personal-Microsoft​-Edge.png

My  test - https://c2n.me/4jxIEhO  - Perhaps I did something wrong?

Hey Pablo,

Please look at the subtotal. It isn't updated with the selected language/currency. Also try to change back to the oppposite language afterwards and the currency is still shown in EURO and not DKK (selected language).

Hello

Ok.  Try  this  code:

add_filter('wp_head', function() { // TranslatePress/Currency Switcher
    $lang = get_locale();
    global $WOOCS;
    switch ($lang)
    {
        case 'en_GB':
            $WOOCS->set_currency('EUR');
$_GET['currency'] = 'EUR';
            break;
        default:
            $WOOCS->set_currency('DKK');
$_GET['currency'] = 'DKK';
            break;
    }
} );

Hello Pablo,

I tried with the new code, cleared cache and deleted history. But the problem isn't solved. Can you please try once again?

The code you gave me is still applied.

Wiliam Skotte Olsen Moderne Oliemaleri | GALLERI FUSION

 

Ok!  there is another possibility to solve this

You need to change the language switching link - https://share.pluginus.net/image/i20231016125425.png

add  ?currency=EUR     OR  ?currency=DKK  - depending on language

an example:

https://gallerifusion.dk/en/wiliam-skotte-olsen-maleri-7/?currency=EUR

How to change the link - You can ask TranslatePress support

Hey,

That solution wont work for me, sorry. I would like to preserve my link integrity/structure for my website.

Do you have another solution in mind?

12