Skip to content

Conversation

@Konamiman
Copy link
Contributor

@Konamiman Konamiman commented Jul 30, 2020

All Submissions:

Changes proposed in this Pull Request:

#26260 introduced a handler for the found_posts filter in the 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 (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:

  1. Login as a customer, go to the orders page in your account and verify that all your orders are listed (place a new order if you didn't have any).
  2. Verify that the functionality introduced in Fix the visibility of partially out of stock variable products when using the layered nav widget #26260 still works.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Not needed since the bug was introduced in 4.4 beta 1 and the fix will be included in the final release.

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.
@Konamiman Konamiman added the release: cherry-pick Commits from this PR also needs to be added to current release branch. label Jul 30, 2020
@Konamiman Konamiman added this to the 4.4.0 milestone Jul 30, 2020
@Konamiman Konamiman self-assigned this Jul 30, 2020
Copy link
Contributor

@claudiosanches claudiosanches left a 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]>
@Konamiman
Copy link
Contributor Author

@claudiosanches Thanks for the fix suggestion, I applied it.

Copy link
Contributor

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@rrennick rrennick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Konamiman Looks good.

@claudiosanches claudiosanches merged commit 2d468a4 into master Jul 30, 2020
@claudiosanches claudiosanches deleted the fix/27162 branch July 30, 2020 17:33
@woocommercebot woocommercebot added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Jul 30, 2020
@claudiosanches claudiosanches removed the release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] label Jul 30, 2020
@Konamiman Konamiman added cherry picked and removed status: approved release: cherry-pick Commits from this PR also needs to be added to current release branch. release: add changelog Mark all PRs that have not had their changelog entries added. [auto] labels Jul 31, 2020
Konamiman added a commit that referenced this pull request Sep 9, 2020
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.
Konamiman added a commit that referenced this pull request Sep 9, 2020
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.
@vedanshujain vedanshujain restored the fix/27162 branch September 10, 2020 08:28
jonathansadowski pushed a commit that referenced this pull request Sep 10, 2020
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.
@kalessil kalessil deleted the fix/27162 branch September 24, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wc 4.4 beta don't show previous orders as a logged customer(in the backend are ok)

5 participants