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

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:woocommerce

And product page looks like:

woocommerce

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 = ‘outofstock’ Where meta_value = ‘instock’ 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

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

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