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 = ‘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:
And of SQLYOG:.
After 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:
And your single product page will look like this:
I hope you enjoy reading this blog post.
If you want my team to do WooCommerce Maintenance for you, click here.