How to find Woocommerce products out of stock with stock greater then zero?

Sometimes, especially if you are using custom plugins to import stock data, you may find products with some stock value (greater then 0) but with stock flag set to “out of stock”. How to find them? Using WP_Query of course:

Notice ‘post_type’ => ‘product_variation’ – if you are not using variations, just change it to ‘product’.

Leave a Reply