add_action('wpo_before_update_cart', function ($cart_data) {
if ( ! class_exists('WOOCS') ) {
return;
}
global $WOOCS;
$location = wc_get_customer_default_location();
$country_code = $location['country'];
if (isset($cart_data['customer']['billing_country']) && $cart_data['customer']['billing_country']) {
$country_code = $cart_data['customer']['billing_country'];
}
if (isset($cart_data['customer']['shipping_country']) && $cart_data['customer']['shipping_country']) {
$country_code = $cart_data['customer']['shipping_country'];
}
$WOOCS->set_currency($WOOCS->get_currency_by_country($country_code));
});WooCommerce Currency Switcher, by PluginUs.NET Print
Created by: Alex Prokaev
Modified on: Thu, 16 Apr, 2020 at 3:17 PM
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.