I have a stock filter on WooCommerce shop page. So I need to filter number of products based on the selection from the user for this filter.

I have variable products and I am not able to control stock via meta_query as the stock value is given at variation level. Is there any way to control stock at product level for variable products ?

I am also thinking to use tax_query for this purpose but I think it could not be implemented in this way.

'tax_query' => array(
    'relation' => 'AND',
         'taxonomy' => 'pa_my_variation',
         'field' => 'max_qty',
         'value' => 33,
         'operator'  => '>='

I do not have a lot of experience with stuff like this so I will really appreciate your suggestion about this issue. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.