• Resolved alkateb

    (@alkateb)


    Hello, I am working with a currency that has inaccurate in the current available aggregates, the rates they’re using are the official ones, while in reality the real market rate is one that is controlled by the black market, so what I did is, I created a function that reads the rate off of a 3rd party site, I read through documentations, and could not find a method that I could call to update exchange rate for a currency.

    Currently I’m doing this, but I’m sure there’s a better way:

    $current = get_option('woocs');
    $current['SYP']['rate'] = $rate;
    update_option('woocs', $current);
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter alkateb

    (@alkateb)

    This does not seem to update it in the database though, this is updating it in real time, I don’t want to call this every time the WordPress is loaded, I want to store it in the database, this will only be called on the next scheduled rate update. Or am I missing something?

    Hello

    In file – \wp-content\plugins\woocommerce-currency-switcher\classes\woocs_after_33.php

    function get_rate()

    Thread Starter alkateb

    (@alkateb)

    Thanks for the reply, I don’t understand why you’re pointing to the get_rate() function, I understand this gets rates from aggregator, I could in fact change the function to include my own code, and set it as the desired aggregator, but this function is not extendable as far as I can see, so this will be overwritten when the plugin is updated.

    But after reading rate_auto_update, I can see the way the currency rate is updated is the same way I’m using above update_option('woocs', $currencies) so I guess I’m doing it right after all

    Thanks for your time

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What method to call to update exchange rate?’ is closed to new replies.