How to manipulate with currencies rates
From version 2.2.9/1.2.9 use field ‘interes‘ in the currencies options!
Old description:
Sometimes some customers need manipulation with currency rates, for example add to USD rate 10%. Every body has its own logic and Math. This article just show how to do this.
- open your theme functions.php
- on the same bottom of the file write next code:
add_filter('woocs_currency_data_manipulation', 'woocs_currency_data_manipulation', 1, 1); function woocs_currency_data_manipulation($currencies) { foreach ($currencies as $key => $value) { if ($key == 'USD') { $currencies[$key]['rate'] = $value['rate'] + 0.10*$value['rate'];//add 10% break; } } return $currencies; }
- fix: for versions lower 2.1.5 in index.php of the WOOCS plugin in public function get_currencies() in code:
if (!empty($currencies) AND ! isset($_POST['woocs_name'])) { //return $currencies; }//comment return!