Fix Admin performance with a large # of zipcodes (#33422)
* Uses WC_Data_Store directly to count the shipping zones to avoid any unncessary query to the D.B * Add changelog
This commit is contained in:
parent
dc70bdfae4
commit
8bed87d91e
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: update
|
||||||
|
|
||||||
|
Uses WC_Data_Store directly to count the shipping zones to avoid any unncessary query to the D.B
|
|
@ -4,6 +4,7 @@ namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
|
use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
|
||||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
||||||
|
use WC_Data_Store;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipping Task
|
* Shipping Task
|
||||||
|
@ -95,7 +96,7 @@ class Shipping extends Task {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function has_shipping_zones() {
|
public static function has_shipping_zones() {
|
||||||
return count( \WC_Shipping_Zones::get_zones() ) > 0;
|
return count( WC_Data_Store::load( 'shipping-zone' )->get_zones() ) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue