- availability:
-
WooCommerce Multilingual Version: 3.5
- description:
-
Filter the exchange rates used by WooCommerce Multilingual.
- type:
- filter
- category:
- Multi-currency Feature
- parameters:
-
add_filter( 'wcml_exchange_rates', 'the_callback_function', 10, 1 );
There is only one parameter passed to this filter: exchange_rates.
- $exchange_rates
- (array) The array includes your site currencies’ rates against the default currency.
- hook example usage:
-
Example
/** * Add this code to the functions.php file of your theme. * * Assume: * EUR = the default currency * USD = the second currency * 1.2 = the exchange rate EUR / USD */ add_filter( 'wcml_exchange_rates', 'filter_exchange_rates', 10, 1 ); function filter_exchange_rates( $exchange_rates ) { $exchange_rates['USD'] = 1.5; // Change the rate EUR / USD to 1.5 return $exchange_rates; }