I would like to show only the list of product ids in the tax query using woocommerce_product_query filter.

So I need to add an additional filter along with a tax query to filter to show only products with given ids.

$tax_query[] = array('add filter to show only specified products');
$q->set( 'tax_query', $tax_query );



Maybe I somehow misunderstood your question, but you don't need the tax_query for that, just use the

$ids = array( <ID1>, <ID2>, ... );
$q->set( 'post__in', $ids );
  • Hi Ivan Thanks for your quick response and it is working. Great Thanks
    – prajosh
    Nov 25 '20 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.