How to Query WooCommerce Variations by Parent Product’s Category

A recent Business Bloomer Club discussion raised an interesting question: Is it possible to retrieve WooCommerce product variations based on their parent product’s category?

This isn’t straightforward since WooCommerce variations don’t directly store taxonomy data, such as categories, which is only assigned to their parent products. However, with a specific approach, you can query variations by referring back to their parent product’s category.

Here’s a guide to achieving this with an SQL solution.

Continue reading How to Query WooCommerce Variations by Parent Product’s Category

Querying WooCommerce Products by Category + Tag

In a recent Business Bloomer Club discussion, a member sought guidance on refining a WooCommerce product query. Initially, they successfully used WP_Query to fetch products but wanted to add filtering based on specific taxonomies, specifically the “3c” category and the “apple” tag.

Members suggested alternative methods, including the WooCommerce-specific wc_get_products function, which offers a streamlined approach for querying products.

Here, we’ll explore how to use both WP_Query and wc_get_products to filter products by category and custom labels.

Continue reading Querying WooCommerce Products by Category + Tag