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:
Moon 2022-06-16 13:52:30 -07:00 committed by GitHub
parent dc70bdfae4
commit 8bed87d91e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -4,6 +4,7 @@ namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks;
use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
use WC_Data_Store;
/**
* Shipping Task
@ -95,7 +96,7 @@ class Shipping extends Task {
* @return bool
*/
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;
}
/**