WCML Custom Base Currency Exchange Rates Updater
Luckily, WooCommerce multi-currency setup is integrable with CurrencyLayer and Fixer.io, but the free plan of CurrencyLayer enables you to get exchange rates using only USD as a base currency. The same applies to Fixer.io which uses the EUR. However, my plugin will help you to make the proper calculations if you are using another currency as a base currency in your WooCommerce settings.
This plugin is created to automatically update currencies exchange rates in the background. This is NOT a currency converter for your users, it works in the background based on WP cronjobs and has NO end-user interface.
- Compatible with both fixer.io and CurrencyLayer.
- Setting the rate for more than 100 currencies.
- Report errors and warnings to admin.
- Based on WP Cron jobs for easier management.
Create a free plan account on CurrencyLayer or Fixer.io. Get the API key and save it somewhere, we will use it later.
Under the WooCommerce » WooCommerce Multilingual » Multi-currency tab, you can add your currencies. Firstly, check the option “Enable automatic exchange rates”. To avoid data duplicating, I did not create new fields to store the settings. Therefore, we will use the same setup of WCML.
Choose whether you would like to use Fixer.io or CurrencyLayer then paste your API key in the text field.
If you have a lifting charge, you can also set it, I considered it in my equation.
Set your Update frequency. I will consider this option if it is set to daily, weekly, or monthly. If you choose the manual option, my plugin will update the exchange rates hourly if you are using fixer.io and once every 4 hours if you are using CurrencyLayer.
Click Save Changes.
Since you have saved the settings in the database, you no longer need the default update option of WCML to be turned on, so uncheck the Enable automatic exchange rates and click Save Changes again. Remember that if you kept it turned on, the WCML will fail because of your custom base currency. This is why you are using my plugin 🙂
Unzip the plugin and upload the entire wcml_exchange_rate_auto_update folder to the /wp-content/plugins directory.
Go to your plugins page in WP admin and activate the plugin WCML Exchange Rate Auto Update.
THE PLUGIN FILE
In Sep. 2019, Currency Layer has limited the monthly free requests to 250 instead of 1000. For that, you should not update the exchange rates on an hourly base. Instead, you may choose
Another option is to run the Cron Job hourly but every time you run it, you will check the latest update time and perform exchange rates update every 4 hours, for example.