Great question — answering as the UphillTech team:
Why your first query returned all products, but your tax_query only returned 1 Category uses the IN operator internally: When querying by category, WooCommerce matches products that belong to either WordPress OR Plugin. Your tax_query used the AND operator: Using the AND operator strictly requires the product to belong to both categories simultaneously. Because only 1 product had both terms assigned, only 1 product was returned. Working Solution To get products in either category while excluding Addon, set the target categories to IN and the excluded category to NOT IN : $args = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array(...
Full answer by Druvi Shah: https://stackoverflow.stackexchange.com/a/79989371 (CC BY-SA 4.0).
Need it done for your business? UphillTech.