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).
Note the count by status in WooCommerce → Subscriptions.
Go to WooCommerce → Status and find Subscriptions by Payment Gateway.
Notice that these results are not correct.
Expected behavior
Subscriptions by Payment Gateway in WooCommerce → Status should display the correct count by status for each payment gateway when HPOS is enabled, and syncing is disabled.
Actual behavior
Subscriptions by Payment Gateway in WooCommerce → Status does not display the correct count by status for each payment gateway when HPOS is enabled, and syncing is disabled.
Product impact
[x] Does this issue affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
[x] Does this issue affect WooCommerce Payments? yes/no/tbc, add issue ref
Describe the bug
The
WCS_Admin_System_Status::get_subscriptions_by_gateway()
function uses a call to$wpdb->get_results(
that will not work with HPOS-enabled stores.This results in incorrect/missing results when rendering Subscriptions by Payment Gateway in WooCommerce → Status.
https://github.com/Automattic/woocommerce-subscriptions-core/blob/07d4d4f93a5d285693d0409a1c39fa68b0629fd9/includes/admin/class-wcs-admin-system-status.php#L364
It is also used by the WCS Rest API.
To Reproduce
Expected behavior
Subscriptions by Payment Gateway in WooCommerce → Status should display the correct count by status for each payment gateway when HPOS is enabled, and syncing is disabled.
Actual behavior
Subscriptions by Payment Gateway in WooCommerce → Status does not display the correct count by status for each payment gateway when HPOS is enabled, and syncing is disabled.
Product impact
Additional context