woocs_currency_data_manipulation
This hook uses in public function get_currencies of the plugin:
public function get_currencies()
{
$default = array(
'USD' => array(
'name' => 'USD',
'rate' => 1,
'symbol' => '$',
'position' => 'right',
'is_etalon' => 1,
'description' => 'USA dollar',
'hide_cents' => 0,
'flag' => '',
),
'EUR' => array(
'name' => 'EUR',
'rate' => 0.89,
'symbol' => '€',
'position' => 'left_space',
'is_etalon' => 0,
'description' => 'Europian Euro',
'hide_cents' => 0,
'flag' => '',
)
);
$currencies = get_option('woocs', $default);
$currencies = apply_filters('woocs_currency_data_manipulation', $currencies);
if (empty($currencies) OR ! is_array($currencies))
{
$currencies = $default;
}
return $currencies;
}
So you can use it for any manipulations with the currencies data.
Example:
add_filter('woocs_currency_data_manipulation', 'my_woocs_currency_data_manipulation', 1, 1);
function my_woocs_currency_data_manipulation($currencies)
{
foreach ($currencies as $key => $value)
{
if ($key == 'USD')
{
$currencies[$key]['rate'] = $value['rate'] + 0.10;
break;
}
}
return $currencies;
}
p.s. From v.2.2.9/1.2.9 interest to currencies rate it is possible to add directly in the currencies options tab!!
