Passing in an invalid status for the subscription_status parameter` behaves differently when HPOS is enabled and when it is not.
While using the CPT storage, WP_Query filters out the invalid post_status resulting in no post_status where clause getting applied to the query causing any subscription status to be returned.
With HPOS, however, the clause for the order_status is still applied to the query, and results in no matching Subscriptions.
Describe the bug
Passing in an invalid status for the
subscription_status
parameter` behaves differently when HPOS is enabled and when it is not.While using the CPT storage,
WP_Query
filters out the invalidpost_status
resulting in nopost_status
where clause getting applied to the query causing any subscription status to be returned.With HPOS, however, the clause for the
order_status
is still applied to the query, and results in no matching Subscriptions.To Reproduce
This can be tested by running the test. See
https://github.com/Automattic/woocommerce-subscriptions-core/blob/1ce49cc29dc69baf681f15043143254d9423b896/tests/unit/test-wcs-functions.php#L1060
Running with HPOS will cause the count assertion to fail.