Woocommerce – Change currency depending on billing country

I’m trying to change the currency depending on the customer’s billing country. Is it possible to do that maybe with an override of the “tax calculation” function as it is updated when the customer change the country ?

At the moment, I have this function (function.php) :

add_filter('wcml_client_currency','change_currency');

function change_currency($client_currency){
global $woocommerce;
$country = $woocommerce->customer->get_country();
if($country == 'CH') {
    $client_currency = 'CHF'; //currency code
} else {
    $client_currency = 'EUR'; //currency code
}
return $client_currency;
}

Thanks for your help


Source: wordpress

Leave a Reply