I've built a plugin and I have the following issue: The WooCommerce Dashboard (in the admin side) will not load the data. It hangs and fails. I have tracked the problem code:
The issue in the
if ( is_admin() ) {
//removed
} else if ( !$this->is_login_page() && !wp_doing_ajax() ) {
$public = new Public();
}
It's the public side code that's causing the issue! and neither is_admin or wp_doing_ajax prevent it from happening.
In the public side, I'm calling
add_action( 'init', array('Dynamic_Rules', 'dynamic_rule_tax_exemption') );
Inside the tax exemption function, I have this code in particular which causes the problem:
$woocommerce = WC();
$user_country = $woocommerce->customer->get_billing_country();
$woocommerce->customer->set_is_vat_exempt(true);
So I can only speculate about what happens, perhaps the WC() is somehow sending everything into an infinite loop, which is why the Dashboard does not load the data. Why is_admin() and wp_doing_ajax() don't prevent this from happening I don't know.
Perhaps it's wrong that I'm calling that function on init, but where else could I call it?
Any help is appreciated