This repository was archived by the owner on May 21, 2025. It is now read-only.
Increase number of args supported by wcs_get_subscriptions()
#811
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To date,
wcs_get_subscriptions()
has supported only a limited set of arguments (some that are specific to Subscriptions queries, and others that map directly to theirWC_Order_Query
equivalents). In the linked issue, which this PR tries to satisfy, it was decided that we should pass any and all arguments across to WooCommerce. This should make it possible to:Fixes #4678
⛑️ How can this code break?
Before now, passing something like
date_created
towcs_get_subscriptions()
would have had no effect by default, but it's not impossible that an extension/custom code implemented support. With this change, we are implicitly add support fordate_created
(and other order query args), and that could lead to a hard-to-predict conflict of some kind. My instinct is that this risk is low, however.🧪 What are we doing to make sure this code doesn't break?
There is already a pretty large battery of unit tests covering different
wcs_get_subscriptions()
queries. Those should provide us with some confidence, and this PR also increases the total number of assertions.How to test this PR
This is primarily a developer-facing change and so, beyond reviewing the change, some freestyle exploration (and comparison) of queries made via
wcs_get_subscriptions()
, with and without this change, will be valuable.Beyond that, you may wish to consider running through flows that involve subscription queries made using
wcs_get_subscriptions()
. I've detailed two such scenarios below, to help verify that we are not introducing any new breakages, though please feel free to look into others:🚏 Subscription Limitations
🎭 Anonymizing Ended Subscriptions
Tip
For this next test, enable HPOS but disable Compatibility Mode. You can also test without HPOS (though, you will need to modify the steps provided here), but again you should ensure Compatibility Mode (Sync) is disabled. This is to avoid some weird side-effects of the sync process impacting your tests.
Product impact