Is there a way to get product_variations in WP_Query that is inside certain woocommerce category?

admin

Administrator
Staff member
Is there a way to get product_variations in WP_Query that filter / only get the product variations that have the right woocommerce-product-category, color (attribute woocommerce), size (attribute woocommerce), price (custom post meta)?

I can't figure out how to make the WP_Query.

Code:
$all_product_variation_query = new WP_Query( array(
'post_type'         => 'product_variation',
'post_status'       => 'publish',
'posts_per_page'    => '-1',
) );

This guy is so close with what i need <a href="https://wordpress.stackexchange.com...ducts-taxonomy-and-product-variations-meta-da">https://wordpress.stackexchange.com...ducts-taxonomy-and-product-variations-meta-da</a>

BUT i need a way to combine Product_Variation with Product and then filter to get only the product_variation with certain color (attribute), size (attribute), and taxonomy id (category)