-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Fix incorrect adjustment of post count in WC_Query #27175
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
Conversation
PR #26260 introduced a handler for 'found_posts' filter in WC_Query class in order to adjust the count depending on the visibility of variation products. However the handler incorrectly assumed that the filter was triggered only when listing products, when actually it's also triggered for any post type e.g. pages. In these cases the post count was set to zero, which caused bugs. Now the handler starts with the originally supplied posts count, and only decrements it when a post is a product AND is not visible.
claudiosanches
left a comment
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.
The code looks good, I left one note to fix a small coding standard issue
Fix small coding standards issue. Co-authored-by: Claudio Sanches <[email protected]>
|
@claudiosanches Thanks for the fix suggestion, I applied it. |
claudiosanches
left a comment
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.
LGTM!
rrennick
left a comment
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.
@Konamiman Looks good.
This commit reverts the functionality introduced in PR #26260 (later refined by #27175, #27190, #27508) in which filtering by attribute using the layered nav widget was improved to handle the cases of variations out of stock. The revert is a response to the numerous problems reported by users in Woo 4.4 and 4.5 Not all the code has been reverted, only the code that resulted in visible functionality changes. Thus, the code that generates term relationships for variations is still in place to keep database consistency and to keep the reverting changes to the minimum needed.
This commit reverts the functionality introduced in PR #26260 (later refined by #27175, #27190, #27508) in which filtering by attribute using the layered nav widget was improved to handle the cases of variations out of stock. The revert is a response to the numerous problems reported by users in Woo 4.4 and 4.5 Not all the code has been reverted, only the code that resulted in visible functionality changes. Thus, the code that generates term relationships for variations is still in place to keep database consistency and to keep the reverting changes to the minimum needed.
This commit reverts the functionality introduced in PR #26260 (later refined by #27175, #27190, #27508) in which filtering by attribute using the layered nav widget was improved to handle the cases of variations out of stock. The revert is a response to the numerous problems reported by users in Woo 4.4 and 4.5 Not all the code has been reverted, only the code that resulted in visible functionality changes. Thus, the code that generates term relationships for variations is still in place to keep database consistency and to keep the reverting changes to the minimum needed.
All Submissions:
Changes proposed in this Pull Request:
#26260 introduced a handler for the
found_postsfilter in theWC_Queryclass in order to adjust the count depending on the visibility of variation products. However the handler incorrectly assumed that the filter was triggered only when listing products, when actually it's also triggered for any post type e.g. pages. In these cases the post count was set to zero, which caused bugs (e.g. orders list appeared empty in customer profiles).Now the handler starts with the originally supplied posts count, and only decrements it when a post is a product AND is not visible.
Closes #27162.
How to test the changes in this Pull Request:
Other information:
Changelog entry
Not needed since the bug was introduced in 4.4 beta 1 and the fix will be included in the final release.