Currency Exchange Rates

WooCommerce Currency Exchange Rates

Automatic currency exchange rates for WooCommerce

Description

WooCommerce Currency Exchange Rates module lets you can setup exchange rates settings for currency pairs used in other Booster’s multicurrency modules:

Currency Exchange Rates Module Options

General Options

All currencies from all enabled modules (with "Exchange Rates Updates" set to "Automatically via Currency Exchange Rates module") will be automatically added to the list.

WooCommerce Currency Exchange Rates - Admin Settings - General Options

Exchange Rates Updates
Here you can select currency exchange rates update interval. Possible values: Update Every Minute; Update Hourly; Update Twice Daily; Update Daily; Update Weekly.
Default: Update Daily
Exchange Rates Server
Possible values: Yahoo; European Central Bank (ECB); TCMB; Fixer.io; Coinbase; CoinMarketCap.
Default: European Central Bank (ECB)
Exchange Rates Rounding
Enable this if you want currency exchange rates to be rounded.
Default: no
Rounding Precision
If rounding is enabled – set precision here.
Default: 0
Exchange Rates Offset – Percent
Here you can add a percent offset to the rates. Can be positive or negative. If both percent and fixed offsets are set – percent offset is applied first and fixed offset after that. For example, let’s say that currency exchange rate for USDEUR pair is 0.84. Then if you set percent offset to 10, resulting rate will be 0.924 (that is: 0.84 + 10%). Please note that this offset is only added on automatic rate updates (it’s not applied when you click "USD/EUR" button to grab rates in real time).
Default: 0
Exchange Rates Offset – Fixed
Here you can add a fixed offset to the rates. Can be positive or negative. If both percent and fixed offsets are set – percent offset is applied first and fixed offset after that.
Default: 0
Calculate with Inversion
If your currency pair have very small exchange rate, you may want to invert currencies before calculating the rate.
Default: no
Always Use cURL
If for some reason currency exchange rates are not updating, try enabling this option.
Default: no

Custom Currencies Options

You can add more currencies in this section. E.g. this can be used to display exchange rates with [wcj_currency_exchange_rate], [wcj_currency_exchange_rates_table] shortcodes.

WooCommerce Currency Exchange Rates - Admin Settings - Custom Currencies Options

Total Custom Currencies
Default: 1
Custom Currency #X
Select additional currency here.
Default: Disabled

Exchange Rates

WooCommerce Currency Exchange Rates - Admin Settings - Exchange Rates

Rate for Currency Pair
Currency exchange rate for the current pair. By pressing button near each currency pair, you can grab current exchange rate.
Default: 0
Exchange Rates Server
If you want use another (i.e. not default / selected above) currency exchange rate server for the current pair, you can set it here. Possible values: Use default; Yahoo; European Central Bank (ECB); TCMB; Fixer.io; Coinbase; CoinMarketCap.
Default: Use default

Developers

Adding Custom Exchange Server

If you wish to add custom exchange server, you need these filters:

  • wcj_currency_exchange_rates_servers and
  • wcj_currency_exchange_rate.

For example, you could add something like this to your (child) theme’s functions.php file:

add_filter( 'wcj_currency_exchange_rates_servers', 'booster_add_exchange_server' );
if ( ! function_exists( 'booster_add_exchange_server' ) ) {
    function booster_add_exchange_server( $servers ) {
        $servers['your_server_id'] = 'Your server title';
        return $servers;
    }
}
add_filter( 'wcj_currency_exchange_rate', 'booster_get_exchange_server_rate', 10, 4 );
if ( ! function_exists( 'booster_get_exchange_server_rate' ) ) {
    function booster_get_exchange_server_rate( $rate, $server, $currency_from, $currency_to ) {
        if ( 'your_server_id' === $server ) {
            // TODO: calculate $rate here (using $currency_from and $currency_to)
        }
        return $rate;
    }
}
Accessible through:
  • WooCommerce > Settings > Booster > Prices & Currencies > Currency Exchange Rates
Tested on WooCommerce 3.4.3 and WordPress 4.9.7
Plugin can be downloaded here. If there are any locked fields in the module, you will need to get Booster Plus to unlock them.

Leave a Reply

Comments

9 Comments

  1. James February 15, 2017 at 3:35 am #

    Hi,

    I am getting lots of php errors logged on my server that all look something like this:
    —————————-
    [03-Feb-2017 20:25:02 UTC] PHP Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/mysite/public_html/wp-content/plugins/woocommerce-jetpack/includes/exchange-rates/class-wcj-exchange-rates-crons.php on line 72
    —————————-

    It seems that some of your code uses the file_get_contents() function, but this requires allow_url_fopen to be on which, as I understand it, is a security risk. So having the allow_url_fopen function turned off (the recomended server config) seems to break something in your code. This website has details and suggests that “If you do need it, the curl module probably can do it better, and refactoring your application to use curl to disable allow_url_fopen may deter the least determined cracker.”

    Do you think you could update the code so it doesn’t require allow_url_fopen to be turned on? I don’t wish to enable this function for jsut one plugin when there are alternatives available that use more secure code.

    Regards, James

    Reply to thread

    • Booster Support Team February 15, 2017 at 7:58 am #

      Hi James,

      I’ve just made the necessary changes to the plugin. Please download the development version here – http://booster.io/dev/. You will need to uninstall the old version first.

      I’ve added cURL as fallback only in “Currency Exchange Rates” module for now, will need some more time to check if there are more modules that needs fixing.

      If possible – please let me know if it works fine now.

      P.S. I saw your other messages in “Prices and Currencies by Country” module – will reply to you there shortly.

      Best regards,
      Tom

      Booster Support Team
  2. Darwin Ramon October 3, 2017 at 4:10 pm #

    Hi
    Could the bitpay exchange rate be added ? https://bitpay.com/bitcoin-exchange-rates for bitcoin the current options to have bitcoin exchange is Yahoo but it is not very realiable 🙁

    Reply to thread

  3. handokogho November 18, 2017 at 10:51 pm #

    hi
    how i set also set Currency Exchange Rates
    for shipping cost and uniq payment code can you explain thanks
    Really make me confused

    Regards

    Reply to thread

  4. Omar March 21, 2018 at 9:20 pm #

    Need bank of england exchange rate, is it possible to automatically add that and it works?

    Reply to thread

    • Booster Support Team March 22, 2018 at 6:27 pm #

      Hi Omar,

      I’ve just made some changes to the plugin. Please download the development version here – https://booster.io/dev/. You will need to uninstall the old plugin version first (don’t worry your saved settings won’t disappear). If you are a Booster Plus user – please let me know (on tom@booster.io) your order number, and I will send you the development version for Plus.

      Now I’ve added “Bank of England (BOE)” server option to “WooCommerce > Settings > Booster > Prices & Currencies > Currency Exchange Rates”. It is taking the rates from here. Needs more testing though…

      Hope that helps.

      P.S. If you like Booster, please leave us a rating.

      Best regards,
      Tom

      Booster Support Team
  5. onur April 11, 2018 at 7:53 am #

    this feature dosen’t work. and support requests are not returning.

    Reply to thread

  6. Stuart Graham July 12, 2018 at 9:25 am #

    After enabling the module and adding currencies it all works fine.

    However going buck to it later the currencies go back to the default 1/1 ratio which of course is not very good.

    Am I doing anything wrong here.

    Reply to thread

    • RokasJ July 12, 2018 at 5:45 pm #

      Hi Stuart,

      Can you contact us at support@booster.io? Thanks.

      Best regards,
      Rokas – Support Team