• I was looking a way to delete products with the out of stock and i found this:

    DELETE p FROM outlet_posts p join outlet_postmeta pm on p.ID = pm.post_id WHERE p.post_type = 'product' and pm.meta_key='_stock_status' and pm.meta_value='outofstock'

    And this work great the only problem it also erase products with a order but not complete (I have a system for reserve a products for 2 days but that put the product at stock 0 for 2 days and then cancel the order)

    So i was looking a way to adapt the query above for erase products that have 0 as stock but are a complete order and not pending.

    Thanks for the help.

  • The topic ‘WooCommerce mysql query for delete products out of stock and complete order’ is closed to new replies.