Bulk edit product stock in WooCommerce plays an important role in managing the products of online stores. This is a routine task of managers to use WooCommerce bulk edit stock options to update the stock status and quantity of items available in their stores.
However, for managers dealing with many physical goods, managing stock in WooCommerce without using appropriate plugins is frustrating.
In addition to the filtering limitations, WooCommerce bulk update stock without plugins is time-consuming, especially for variable products.
For this reason, in this post, we first describe the WooCommerce bulk edit stock method without plugins and then introduce two practical plugins to help you do WordPress stock management more easily and quickly.
WooCommerce update stock quantity programmatically
The first method we are going to describe is edit stock programmatically. Although this method can help you to bulk stock management easily. We recommend you use it only if you have enough knowledge about coding. It is also essential to back up your website data before running these codes. So you can make sure that you can restore your data in case of any problems.
Now, you are ready to WooCommerce update stock by update_post_meta() function.
The meta keys used in this function are:
- _manage_stock: To enable WooCommerce manage stock.
- _stock: To let WooCommerce get stock quantity by product id.
- _stock_status: To update WooCommerce stock status like instock, outofstock, etc.
So, after finding those values in the database, you can use the below code to WooCommerce update stock:
$product_id = 12;
update_post_meta( $product_id, '_manage_stock', 'yes' ); // yes or no
update_post_meta( $product_id, '_stock', 100 );
update_post_meta( $product_id, '_stock_status', 'instock' );
By running this code, the result is something like this:
But this method doesn’t work properly for WooCommerce stock management variations. Inserting WC_Product_Variable::sync() or wc_delete_product_transients() in the code is not helpful either.
The best solution is to use set_stock_status() and set_stock_quantity() in CRUD layers.
This is a sample code for editing the WooCommerce variation stock quantity of product with ID No. 12:
$product_id = 12;
$product = wc_get_product( $product_id ); // object of WC_Product class
// for variations
// $product = wc_get_product_object( 'variation', $product_id );
$product->set_manage_stock( true ); // true/false
$product->set_stock_quantity( 100 );
//$product->set_stock_status( 'instock' );
// always
$product->save();
It is also possible to use REST API as follow:
$product_id = 12;
wp_remote_request(
"https://YOUR STORE/wp-json/wc/v3/products/{$product_id}",
array(
'method' => 'PUT',
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( "$login:$pwd" )
),
'body' => array(
'manage_stock' => true,
//'stock_status' => 'instock',
'stock_quantity' => 100,
)
)
);
If you want to use this code for WooCommerce manage stock at variation level, use the below code to change the endpoint:
/wp-json/wc/v3/products/{$product_id}/variations/{$variation_id}
As you may notice, we used all of these codes for the product with ID #12 and set the WooCommerce stock quantity of that product to 100. However, you can change both figures to apply this WooCommerce bulk stock management code based on your needs.
Bulk edit product stock in WooCommerce without plugin
For WooCommerce bulk edit stock, you must first open the All Products page in the WooCommerce tab.
On this page, you can see a list of all products in your online store and try to bulk edit stock status and stock management by following the below instructions:
- Filter the products
There are three options available in the WooCommerce for filtering the products:
- Select a category: By choosing one of the categories in the list, the products in that category are displayed in the table.
- Filter by product type: You can filter simple, variable, grouped, … products by choosing one of the items in the dropdown list.
- Filter by stock status: You can filter In-stock, out-of-stock, or on-backorder products in this field.
- Select filtered products in the result table
In the next step, you need to mark some products in the table as shown below:
- Bulk stock management in WooCommerce
Finally, open the dropdown list of Bulk Actions and choose the Edit option.
In the Bulk Edit Form, you can bulk update stock in WooCommerce by changing the values of the below fields:
- In stock? field: You can bulk update stock status in this field by choosing In stock, Out of stock, or On backorder options.
- Manage stock? Field: You can choose Yes or No to specify if the selected products need stock management.
- Stock Qty field: You can set a new quantity for selected products by setting a fixed value or increase/decrease the existing stock quantity by up-down arrows:
For example, we chose Out of Stock from the “In Stock?” Field and click on the Apply button at the top of the table. So, the result was as follows:
What are the limitations of the default WooCommerce bulk edit stock?
As mentioned earlier, bulk edit stock products in WooCommerce have many limitations. The most important of which is the limitation in product filtering. In the default WooCommerce options, you can only filter products by category, product type, and stock status. Therefore, for example, it is impossible to bulk edit the stock status or quantity for products with a certain price.
Another important limitation is the impossibility of WooCommerce variable product stock management. If you want to bulk edit the stock status of products with specific variations, you must open the page of variable products individually and change their stock status. This will waste a lot of time for the site manager and increase the possibility of making mistakes.
The ultimate solution to these problems is to use the WooCommerce products bulk edit plugin and WooCommerce variations bulk edit plugin, which we will explain more about in the following.
WooCommerce bulk update stock with the plugin
WooCommerce inventory management can be overwhelming, even for simple products without plugins. WooCommerce store managers can use the features of WooCommerce products bulk edit plugin and have full control of stock management, especially for simple products.
Let’s review the WooCommerce bulk edit stock of simple products by getting help from this plugin.
Bulk edit stock fields of simple products in WooCommerce
The WooCommerce products bulk edit plugin allows you to easily manage and edit the inventory of many products in your WooCommerce store simultaneously. By displaying products in a table with complete specifications, this plugin allows you to bulk edit your product stock flexibly and straightforwardly.
WooCommerce Products Bulk Edit Plugin
The easy way to WooCommerce bulk stock management
One of the advantages of this plugin is the possibility of filtering products based on all fields available in WooCommerce so that you can apply your changes to the products you want in the shortest possible time.
After installing and activating this plugin, you must click on the Woo products menu in the WordPress dashboard to enter the bulk edit page of the products.
Now, you can bulk update product stock in WooCommerce by following the below steps:
Filter WooCommerce products by flexible filter form
You can use a comprehensive filter form in this plugin to limit the products for bulk edit stock status or stock quantity.
In this form, all WooCommerce fields are divided into eight different tabs to help you easily find the items you need for filtering.
As we are going to bulk update the stock of simple products in this post, open the Type tab and choose Simple product in the Product Type field.
Select filtered product in the product table
After filtering the simple products, you can mark desired products in the product table.
Bulk edit product stock in WooCommerce bulk product editing plugin
In the next step, you can open Bulk Edit Form and go to the Stock tab to manage product stock fields, which are:
WooCommerce manage stock field
Choose Yes or No to change the product manage stock field.
WooCommerce stock status field
Bulk edit the stock status of selected products by choosing one of the options in the dropdown list.
WooCommerce stock quantity field
Bulk update stock quantity of selected products by using one of the below operators:
- Set new: Set a new stock quantity for selected variations.
- Clear value: Remove the stock quantity of selected variations.
- Formula: Use formula to edit the stock quantity.
In this type, the current quantity is known as X. For example, you can write (X+2)*20%.
- Increase/Decrease by value: Write a number to let the plugin to bulk edit the stock quantity by fixed amount.
- Increase/Decrease by percent: Write a number to let the plugin to bulk edit the quantity by percent amount.
WooCommerce allow backorders field
Manage WooCommerce backorders by assigning one of the items in the list to the selected products.
Finally, by pressing the Do Bulk Edit button on the bottom of the Bulk Edit Form, your desired changes will be applied to all selected products at once.
WooCommerce stock management variations for variable products
Another problem for online store managers is Woocommerce variable product stock management. WooCommerce’s default options do not allow bulk editing of products with similar variables, and managers have to do repetitive and tedious tasks to change the stock status or quantity by editing variable products individually.
However, the bulk editing variations plugin has solved this problem with a simple and practical user interface. In the following, we will show you how to manage the stock of variable products with this amazing plugin.
The WooCommerce variations bulk edit plugin is a versatile solution that is used to manage stock in the WooCommerce store and helps online business owners easily bulk edit any feature of the variable products. This plugin also helps managers filter variable products based on all fields in WooCommerce and then change the stock status and quantity of filtered variable products using a comprehensive bulk edit form.
Now, let’s see how easily you can bulk edit variable product stock in WooCommerce with this amazing plugin.
Step 1: Filter desired products to manage stock fields
Suppose you install and activate the WooCommerce bulk edit variations plugin on your WordPress website. In that case, opening the main page by pressing the Woo Variations menu in the WordPress dashboard is possible.
On this page, you can find a toolbar on the top of the product table in which the Filter Form is the first icon.
By opening the Filter Form, you can access all WooCommerce fields divided into seven tabs to make a better experience for you.
For example, when you want to bulk edit the stock status or stock quantity of variable products, you can easily go to the Type tab, choose Variable Products from the Product Type field, and then press the Get Products button to receive the products in the table.
Step 2: Select products in the table and choose manage variations stock
After filtering the products, you can mark one or more of them in the result table and choose the Manage Variation option, as illustrated in the picture below, to manage WooCommerce variable product stock.
Step 3: Bulk edit variation products stock field
In the Manage Variations page, you will find a list of all variations related to the selected products in the table.
If you want to manage one of the variations stock, it is possible to click on the Edit icon under the ID of that variation. (1)
However, if you want to bulk edit stock status or stock quantity of multiple variations, mark the variations in the table first, then choose the Bulk Edit icon on the top (2).
Now, you can choose one of the options below:
- Selected variations: If you marked some of the variations in the below table and you want to manage their stock, choose this option.
- All variations of the selected products: If you want to bulk edit the stock of all variations related to the selected products, use this option.
After selecting one of the options, the Bulk Actions form is displayed, and you have to follow the below steps to manage Variations stock:
- Find the Manage Stock field and choose Yes from the dropdown list.
- Press on the Manage Stock tab that just appeared to you at the top of the table.
In the manage stock tab, change the value of the fields you need which are:
- Stock quantity
- Low stock threshold
- Allow backorders
Note: The operators available for the first two fields and the options for Allow back orders are similar to the Stock Quantity section, which we have described in the previous section about bulk editing simple products stock.
When you make the changes you want, press the Do Bulk button to see the changes in the selected variable products.
Why WooCommerce bulk stock management is important?
Stock management is essential for running a successful online store and critical to making a better customer experience.
Since inventory directly impacts your revenue, a WooCommerce inventory management system is necessary for your online store. For example, you must be aware of the low-stock or out-of-stock products to provide them on time and satisfy your customers. After all, you can’t afford to miss the opportunity to sell in-stock products by implementing proper marketing strategies.
WooCommerce Products Bulk Edit Plugin
The easy way to WooCommerce bulk stock management
Summary
WooCommerce stock management helps you bulk edit product stock in WooCommerce more easily and saves time to focus on more important tasks.
As you know, manually editing the product stock takes hours; doing the same thing through WooCommerce bulk update stock plugins will only take a few minutes. With just a few clicks, you can filter the products you want and change their stock status or quantity simultaneously.