i have product post type and i have product_cat is the taxonomy . In product_cat i have red, hard, soft, pen entires .
So i have to get the products coming under red and it coming hard or soft
How can i get this ?
For a product that come under both red and hard and soft i can use the following query
$args = array(
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => 'red'
),
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => 'hard'
),
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => 'soft'
)
),
'post_type' => 'product',
'orderby' => 'title',
);
But what i need is red is must and either in soft or hard .
ie (red && (soft||hard ))
Please help .