New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not override pagination args if woocommerce_hpos_pre_query
doesn't override query
#40551
Conversation
Hi @barryhughes, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
…tion args unless used.
9f6c584
to
5a9a6ce
Compare
Test Results SummaryCommit SHA: 17f81d1
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
@@ -351,16 +351,22 @@ public function test_pre_query_escape_hook_pass_limit() { | |||
* @testdox A regular query will still work even if the pre-query escape hook returns null for the whole 3-tuple. | |||
*/ | |||
public function test_pre_query_escape_hook_return_null() { | |||
add_filter( 'woocommerce_hpos_pre_query', '__return_null', 10, 3 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it really matters, but we could simplify this to:
add_filter( 'woocommerce_hpos_pre_query', '__return_null', 10, 3 ); | |
add_filter( 'woocommerce_hpos_pre_query', '__return_null' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
- Straightforward change, tests well locally when invoking it via
wp eval
. - Confirmed the order list table is not impacted by this change (the filter and the condition following it are invoked when accessing this screen) and that pagination continues to work as expected.
- I don't think there is a need for further analysis in this case, so will merge directly.
…'t override query (#40551)
* Do not override pagination args if `woocommerce_hpos_pre_query` doesn't override query (#40551) * Prep for cherry pick 40551 --------- Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com> Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
Submission Review Guidelines:
Changes proposed in this Pull Request:
In #39945 we introduced a filter (
woocommerce_hpos_pre_query
) that allows overriding of HPOS queries, but it currently sets internal pagination variables toNULL
even when not actually being used:woocommerce/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php
Line 233 in 8a6fcd8
This is incorrect as those variables have default values (of
0
) which should be preserved unless the query is, in fact, overridden.Closes #40548.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
wp run-eval
orwp shell
):total
andmax_num_pages
should be 0.Changelog entry
Significance
Type
Message
Comment