fbpx
Currency Exchange Rates

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.__ALG_REMOVE__
Default: Update Daily
Exchange Rates Server
__ALG_REMOVE__
Default: European Central Bank (ECB)
Exchange Rates Rounding
Enable this if you want currency exchange rates to be rounded.__ALG_REMOVE__
Default: no
Rounding Precision
If rounding is enabled - set precision here.__ALG_REMOVE__
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).__ALG_REMOVE__
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.__ALG_REMOVE__
Default: 0
Calculate with Inversion
If your currency pair have very small exchange rate, you may want to invert currencies before calculating the rate.__ALG_REMOVE__
Default: no
Always Use cURL
If for some reason currency exchange rates are not updating, try enabling this option.__ALG_REMOVE__
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
__ALG_REMOVE__
Default: 1
Custom Currency #X
Select additional currency here.__ALG_REMOVE__
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.__ALG_REMOVE__
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.__ALG_REMOVE__
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’ );<br />
if ( ! function_exists( ‘booster_add_exchange_server’ ) ) {<br />
    function booster_add_exchange_server( $servers ) {<br />
        $servers[‘your_server_id’] = ‘Your server title’;<br />
        return $servers;<br />
    }<br />
}<br />
add_filter( ‘wcj_currency_exchange_rate’, ‘booster_get_exchange_server_rate’, 10, 4 );<br />
if ( ! function_exists( ‘booster_get_exchange_server_rate’ ) ) {<br />
    function booster_get_exchange_server_rate( $rate, $server, $currency_from, $currency_to ) {<br />
        if ( ‘your_server_id’ === $server ) {<br />
            // TODO: calculate $rate here (using $currency_from and $currency_to)<br />
        }<br />
        return $rate;<br />
    }<br />
}

Accessible through:
  • WooCommerce > Settings > Booster > Prices & Currencies > Currency Exchange Rates
Tested on WooCommerce 4.6.2 and WordPress 5.5.3
Plugin can be downloaded here. If there are any locked fields in the module, you will need to get Booster Plus to unlock them.