• Resolved lands23

    (@lands23)


    Hi,

    I am trying to use the operator AND in wc_get_products like so:

    $products = wc_get_products(array(
        'limit'  => 4, // All products
        'status' => 'publish',
        'category' => array( 'category1', 'category2' ,'category3'),
        'operator' => 'AND' 			
    	 
    ) );

    it doesn’t seem to work at all as it retrieves products from all 3 categories.
    any way to fix that?

Viewing 1 replies (of 1 total)
  • Hello,

    it doesn’t seem to work at all as it retrieves products from all 3 categories.

    To be sure if I understood this correctly, are you looking to get products that belong to all the three categories at the same time? Or are you looking for something different? Can you please provide more information about what is your goal? So that we can provide you an alternative solution if applicable.

Viewing 1 replies (of 1 total)
  • The topic ‘wc_get_products QUERY’ is closed to new replies.