-1

How can i fetch products by terms? in taxonomy pa_color i have a lot of colors inside and i can't write all names in array how i can fetch all products with all terms id?

'tax_query'      => array( array(
        'taxonomy'        => 'pa_color',
        'field'           => 'slug',
        'terms'           =>  all,
        'operator'        => 'IN',
    ) )
) );
Ahmed java
  • 17
  • 4
  • Does this answer your question? [WooCommerce get products by attribute query](https://stackoverflow.com/questions/45828655/woocommerce-get-products-by-attribute-query) – Bazdin Feb 02 '22 at 20:05

1 Answers1

0

Try this:

'tax_query'      => array( array(
        'taxonomy'        => 'pa_color',
        'field'           => 'slug',
        'operator'        => 'EXISTS',
    ) )
) );
Artemy Kaydash
  • 459
  • 5
  • 4