I have variable products and it has attribute named: 'Quantity' which has variations like '100', '200', '500'. All these variations have regular prices. I want to filter and display variables products which has Quantity variation '200' and has regular price 10.
I am using this code but it's showing all products which has Quantity variation '200' but not filtering by variation's regular price.
$query = array(
'post_status' => 'publish',
'post_type' => array('product', 'product_variation'),
'posts_per_page' => 10,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'pa_quantity',
'field' => 'term_id',
'terms' => '67',
),
'meta_query' => array(
array(
'key' => '_regular_price',
'value' => 10,
'compare' => '=',
'type' => 'NUMERIC'
),
),
)
);
For instance, I am using attribute Quantity's term 200's id which is 67.