This PR refactors the WCS_Admin_System_Status::get_subscriptions_by_gateway() to provide the correct subscription count by status & payment gateway when HPOS is enabled.
This function is used when rendering Subscriptions by Payment Gateway in WooCommerce → Status and the WCS Rest API.
How to test this PR
Enable HPOS + no syncing.
Purchase a few subscriptions with 1 or more payment gateways.
Change the status of 1 or more subscriptions (e.g. move to trash, cancel, place on hold).
Go to WooCommerce → Status and find Subscriptions by Payment Gateway.
Ensure these values are correct by comparing with WooCommerce → Subscriptions and filtering by Payment Gateway.
Enable HPOS syncing and wait for the sync to complete.
Ensure the WooCommerce → Status → Subscriptions by Payment Gateway are correct.
Disable HPOS.
Ensure the WooCommerce → Status → Subscriptions by Payment Gateway are correct.
WCS REST API
I have tested the output provided to the /wp-json/wc/v3/system_status endpoint when WCS is enabled, and can confirm that the results are correct with both HPOS enabled/disabled.
Fixes #384
Description
This PR refactors the
WCS_Admin_System_Status::get_subscriptions_by_gateway()
to provide the correct subscription count by status & payment gateway when HPOS is enabled.This function is used when rendering Subscriptions by Payment Gateway in WooCommerce → Status and the WCS Rest API.
How to test this PR
WCS REST API
I have tested the output provided to the
/wp-json/wc/v3/system_status
endpoint when WCS is enabled, and can confirm that the results are correct with both HPOS enabled/disabled.This can be tested (optional) by:
is_ssl()
with a truthy value on this line within WC.GET
request to/wp-json/wc/v3/system_status
.subscriptions.subscriptions_by_payment_gateway
.Example:
Product impact