This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Fix: Product Query editor preview with Stock Status setting #7682
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
18de845
fix: update the rest query to include stock status meta query, so edi…
dinhtungdu 4306b2f
bot: update checkstyle.xml
github-actions[bot] e2a170f
Merge branch 'trunk' into fix/product-query-preview-stock-status
dinhtungdu 630a6c0
Merge branch 'trunk' into fix/product-query-preview-stock-status
dinhtungdu b17417e
Merge branch 'trunk' into fix/product-query-preview-stock-status
dinhtungdu c456f87
refactor the get_stock_status_query to return an empty array for empt…
dinhtungdu 459d617
Merge branch 'trunk' into fix/product-query-preview-stock-status
dinhtungdu c0e1dbd
Merge branch 'trunk' into fix/product-query-preview-stock-status
dinhtungdu 8c53a13
update stock query handling to align with attribute query
dinhtungdu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
What is the advantage of this over
array_merge( $args, $on_sale_query, $stock_query )
? We need to consider that we'll add more and more queries, already in #7687 I add another one which will conflict here, how should we do this in the future?E.g.
How do we decide what's
$b
in themerge_queries
call?My suggestion here is to actually refactor the
merge_queries
call to accept multiple arguments, like most PHP array functions do. So the signature would bemerge_queries(array ...$queries)
. I had suggested it here when this function was implemented, but we didn't go ahead with it because the advantages were not clear.Now that we meet this problem, I think the advantages of having that is clearer, because we'll keep adding queries and we should just be able to do:
and don't worry about the internal implementation of that. What do you think?
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.
@sunyatasattva With the current implementation of the class and structure of WP_Query, we have to use
merge_queries
for tax and meta query astax_query
andmeta_query
are arrays containing arrays.As I mentioned above, queries containing
tax_query
and/ormeta_query
are$b
.I strongly agree.
merge_queries
should be the source of trust in merging queries. I can refactor it either in this PR or a follow-up PR. Tagging @gigitux here for more perspectives :)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 created #7697, so we have more things on the table to discuss.