WooCommerce WP_Query using tax_query returns no results (0 = 1)
I am trying to get specific Products from WooCommerce baseed on a Product Attribute (taxonomy).
$args = array( 'post_type' => array('product', 'product_variation'), 'post_status' => 'publish', 'tax_query' => array( array( 'taxonomy' => 'pa_range-kwh', 'terms' => 'k2', 'field' => 'slug', 'operator' => 'IN', 'include_children' => true, ), ), );
From an SQL point of view
I can see that:
SELECT * FROM `wp_terms` WHERE term_id = 891
SELECT * FROM `wp_term_taxonomy` where term_id = 891
SELECT * FROM `wp_term_relationships` where term_taxonomy_id = 891
Although there is at least one product where the taxonomy is added, I keep on receiving 0 results due to the inner query returning (0 = 1), meaning it can’t find any product with this taxonomy attributed.
Any ideas on what could I do to overcome this?