How to change all product status to out of stock in Woocomemerce?

In this tutorial, we’ll learn how to change status of all products in woocommerce to out of stock.

We can achieve this by using one simple query.

First of all let me show you how my product archive and single product pages look like.

Here is my product archive page:


And product page looks like:


Now we need to change product status to out of stock.

Here is the query that will do the job for us:

Update wp_postmeta Set meta_value = 'instock' Where meta_value = 'outofstock' And meta_key = '_stock_status'

You can implement this query either through phpmyadmin of your site or by using any other GUI DB tool like SQLYOG.

Write and execute this query in the terminal.

Here is the terminal of phpmyadmin:

woocommerceAnd of SQLYOG:.

woocommerceAfter executing the query, go to product listing and product pages and you’ll notice all the products of your site are out of stock now.

Now your archive product page will look like this:

woocommerceAnd your single product page will look like this:

woocommerceCHEERS J

Editorial Staff

ThemeLocation Provides Wordpress & Woocommerce development & Customization services. Have a Project? Contact To discuss

Leave a Reply

Your email address will not be published. Required fields are marked *