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

How to manipulate more than one currency rate?

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.

Hello,

I have the premium plugin and was able to use your snippet: https://currency-switcher.com/how-to-manipulate-with-currencies-rates/ to successfully adjust prices from one currency rate (EUR). However when I duplicated the snippet for another currency I got an error. I also tried duplicating some lines in the snippet and changing EUR to GBP for example, but as I am not a programmer I failed miserably.

Please advise how I can use or change this snippet to adjust multiple currencies (prefer the ability to have different rates for different currencies, but to have one rate for multiple currencies would also also be good).

Thanks,

Nick

Hello Nick

For all  currencies:

add_filter('woocs_currency_data_manipulation', 'woocs_currency_data_manipulation', 1, 1);

function woocs_currency_data_manipulation($currencies)
{
foreach ($currencies as $key => $value)
{

$currencies[$key]['rate'] = $value['rate'] + 0.10*$value['rate'];//add 10%

}
return $currencies;
}

 

Hi Pablo,

Thanks; that way also adjusts the shop's base currency prices along with all the others. Is there any way to adjust all prices except for in the shop's base currency?

Thanks,

Nick

Hello Nick

add_filter('woocs_currency_data_manipulation', 'woocs_currency_data_manipulation', 1, 1);
function woocs_currency_data_manipulation($currencies)
{
    foreach ($currencies as $key => $value)
    {
        if ($key != 'YOUR_BASE_CURRENCY')
        {
            $currencies[$key]['rate'] = $value['rate'] + 0.10*$value['rate'];//add 10%
            break;
        }
    }
    return $currencies;
}
To customize the code, you should hire a developer