WordPress query : Category and product variation attribute

The product cat not works in this query. If i remove ‘product_cat’ => ‘Apple’, the query works. Why?

$args = array(
‘product_cat’ => ‘Apple’,
‘post_type’ => array(‘product’, ‘product_variation’),

‘post_status’ => ‘publish’,
‘key’ => ‘_visibility’,
‘value’ => ‘visible’,
‘posts_per_page’ => 100,

‘taxonomy’ => ‘pa_size’,
‘meta_value’ => ’39’,
‘meta_query’ => array(
array(
‘key’ => ‘_stock’,
‘value’ => 0,

‘compare’ => ‘>’
)
)

Read more here:: WordPress query : Category and product variation attribute

Leave a Reply

Your email address will not be published. Required fields are marked *