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
- WooCommerce Currency per Product
- WooCommerce Multicurrency Product Base Price
- WooCommerce Multicurrency (Currency Switcher)
- WooCommerce Payment Gateways Currency
- WooCommerce Prices and Currencies by Country
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.
- 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
- Default:
- Exchange Rates Server
- Possible values: Yahoo; European Central Bank (ECB); TCMB; Fixer.io; Coinbase; CoinMarketCap.
- Default:
European Central Bank (ECB)
- Default:
- Exchange Rates Rounding
- Enable this if you want currency exchange rates to be rounded.
- Default:
no
- Default:
- Rounding Precision
- If rounding is enabled – set precision here.
- Default:
- Default:
- 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:
- Default:
- 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:
- Default:
- Calculate with Inversion
- If your currency pair have very small exchange rate, you may want to invert currencies before calculating the rate.
- Default:
no
- Default:
- Always Use cURL
- If for some reason currency exchange rates are not updating, try enabling this option.
- Default:
no
- Default:
Custom Currencies Options
You can add more currencies in this section. E.g. this can be used to display exchange rates with ,
shortcodes.USD / EUR 0.962464 USD / AED 3.673108 USD / CAD 1.438499 USD / GBP 0.798508 USD / BRL 6.080173 USD / CNY 7.298471
- Total Custom Currencies
-
- Default:
- Default:
- Custom Currency #X
- Select additional currency here.
- Default:
Disabled
- Default:
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:
- Default:
- 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
- Default:
Developers
Adding Custom Exchange Server
If you wish to add custom exchange server, you need these filters:
wcj_currency_exchange_rates_servers
andwcj_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 4.0.0 and WordPress 5.3.2Plugin can be downloaded here. If there are any locked fields in the module, you will need to get Booster Plus to unlock them.
WooCommerce Booster ModulesWooCommerce CurrenciesWooCommerce Currency Exchange RatesWooCommerce MulticurrencyWooCommerce Prices