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));

});