I'm using the following query to extract all products which are not in the 'Service' product category and order them by a custom meta field '_vintage_age'.
$q->set( 'tax_query', array(array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'Service' ),
'operator' => 'NOT IN'
)));
$q->set('meta_query',array(array(
'vtp_age' => array(
'key' => '_vintage_age',
'value' => array(1,2,3),
'compare' => 'IN'
))));
$q->set('orderby',array(
'vtp_age' => 'ASC',
'date' => 'ASC'
));
I now need to extend this query to EXCLUDE products which have been modified with the product_category 'Sold' more than 1 month ago (ie. display all unsold, non serviced products and all products sold in the last month). My guess is to use something like this, but how do I apply this to 'Sold' products only AND add it to my original query?
array(
'date_query' => array(
array(
'column' => 'post_modified_gmt',
'after' => '1 month ago',
),
))
Thanks in advance for any help!