In #372 we introduced a new data store function that returns an array of subscription statuses and the number of subscriptions on the store with that status:
In this PR, I'm updating all uses of wp_count_posts() with this new data store function.
Notes
The wcs_is_large_site() was also counting the number of orders on a store but there's currently not HPOS equivalent function for this so for the time being I've opted into just leaving this count out of the condition when HPOS is enabled.
There's a wp_count_posts() calls in the repair script files that I didn't bother updating in this PR because it's a repair script specifically for stores upgrading from 2.0.0 to 2.0.2
How to test this PR
To test the Admin System Status changes:
Enable HPOS and purchase a handful of subscriptions
Change some statuses of the subscriptions
View WooCommerce > Status
Scroll down to Subscriptions section and look at the Subscription Statuses: row.
Disable HPOS and purchase some more subscriptions to test with HPOS disabled.
For the rest of the changes I ran the following snippet in WP Console and tested with HPOS enabled and disabled:
Fixes #382
Description
In #372 we introduced a new data store function that returns an array of subscription statuses and the number of subscriptions on the store with that status:
In this PR, I'm updating all uses of
wp_count_posts()
with this new data store function.Notes
wcs_is_large_site()
was also counting the number of orders on a store but there's currently not HPOS equivalent function for this so for the time being I've opted into just leaving this count out of the condition when HPOS is enabled.wp_count_posts()
calls in the repair script files that I didn't bother updating in this PR because it's a repair script specifically for stores upgrading from 2.0.0 to 2.0.2How to test this PR
To test the Admin System Status changes:
Subscription Statuses:
row.For the rest of the changes I ran the following snippet in WP Console and tested with HPOS enabled and disabled:
Product impact