woocommerce/tests/legacy
Nestor Soriano 9c6c0d73d8 Record attribute terms for product variations in wp_term_relationships.
Product attributes are currently recorded as terms in
wp_term_relationships (product attributes are actually taxonomies).
In the case of variable products this is true for the main product,
but not for the variations. The attributes used to define variations
are stored as post meta, but nothing is recorded in the term
relationships table.

This is a problem when using the layered nav filtering plugin,
since the attribute counters displayed are calculated based solely
on the contents of the term relationships table. Adding meta queries
would be really messy (especially when the widget is configured
with AND operator) and would probably also hurt performance.

This commit adds a change to store the attributes for variations
as term relationships, additionally to storing them as post meta.
Terms are stored on variation creation, and updated/deleted together
with the variation as appropriate. "Any" variations (stored in meta
as empty values) are not stored as terms.

Additionally, a database upgrade is included in order to backfill
terms for already existing products.
2020-07-28 08:55:55 +02:00
..
data Add unit test and a sample Woo plugin file 2020-05-01 22:47:08 +05:30
framework Refactor WC_Helper_Product by extracting duplicated code to methods. 2020-07-28 08:55:55 +02:00
includes Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
unit-tests Record attribute terms for product variations in wp_term_relationships. 2020-07-28 08:55:55 +02:00
bootstrap.php Moved autoloading of `Automattic\WooCommerce\Testing\Tools` namespace into test bootstrap 2020-07-24 09:25:09 +02:00
classes-with-mockable-static-methods.php Code hacker resdesign for single-load of code files. 2020-06-02 19:06:53 +02:00
mockable-functions.php Code hacker resdesign for single-load of code files. 2020-06-02 19:06:53 +02:00