wordpress function breaks wp-admin
PHP Snippet 1:
function geo_client_currency( $client_currency ) {
if ( WC()->customer ) {
$country = WC()->customer->get_shipping_country();
/**
* Assuming more are going to be added otherwise a switch is overkill.
* Short example: $client_currency = ( 'GB' === $country ) ? 'GBP' : 'EUR';
*/
switch ( $country ) {
case 'GB':
$client_currency = 'GBP';
break;
default:
$client_currency = 'EUR';
}
}
return $client_currency;
}
add_filter( 'wcml_client_currency', 'geo_client_currency' );