woocommerce/tests/legacy/unit-tests/util
Nestor Soriano 50e8f27bc7 Fix visibility of variable products with layered nav filtering.
The layered nav filtering doesn't work well with variable products
when some variations have stock and other don't. When a term is
selected in the widget, a variable product having no stock for
the variation corresponding to that term but having stock for
other variations will be displayed, but it shouldn't.

This commit fixes that by introducing two changes:

- A new override of "is_visible" for WC_Product_Variable that
  looks at the supplied filters, compares them against the corresponding
  available variations and calculates the visibility based on
  the query type (OR or AND).

- A hook on the "found_posts" filter in WC_Query, that adjusts
  the posts count based on the found products visibility
  when there are filters available; this is needed to sync the
  "displaying X posts" messages and the paging when variable
  products are hidden due to stock status.

Additionally, the visibility calculated in "found_posts" is cached
as loop variables so that it isn't calculated again when actually
displaying the products.
2020-07-28 08:55:52 +02:00
..
api-functions.php Improvements on the code hacker. 2020-05-20 09:56:26 +02:00
class-wc-rate-limiter.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
class-wc-tests-core-functions.php Moved unit tests to the new location. 2020-05-28 11:18:47 +02:00
class-wc-tests-user-functions.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
class-wc-tests-wc-query.php Fix visibility of variable products with layered nav filtering. 2020-07-28 08:55:52 +02:00
conditional-functions.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
deprecated-hooks.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
dummy-wc-logger.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
install.php Disabled flaky test 2020-07-01 19:09:50 +05:30
notice-functions.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
plugin-updates.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
validation.php Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00