Last Updated on: 7th February 2024, 08:58 pm
WooCommerce allows to manage inventory for each product and product variations. Enable the “Manage Stock?” option to make the following visible:
Screenshot of the inventory tab of a WooCommerce Simple product.
WooCommerce has two options used to manage stock.
- The stock quantity which counts the number of available items.
- The stock status which manages the availability of the product on the front end.
In the default configuration backorders are not allowed. This ensues the following behaviour:
- Setting the stock quantity to zero or having it fall to zero due to a sale automatically sets the stock status to “Out of stock”. This is then reflected in your front end like so:
backorders = do not allow
stock quantity = 0
stock status automatically set to “out of stock” due to stock quantity below 1
This is how most stores handles this. Now lets add the backorder option to the configuration and play through all three possible options.
Contrary to simple products the standard inventory tab is not used. This means that despite active stock control your inventory tab for your variable product will have:
- “Manage stock?” unchecked
- No stock quantity
- No SKU
- No relevant Stock status
No need to be alarmed by this. Instead these are now located with each product variation:
As long as backorders are set to “Do not allow”, the following is true:
- The product cannot be ordered from the front end.
- The stock quantity can be set to negative number, for example “-3” via the product edit screen in the backend.
- An order added manually via the WooCommerce backend will not decrease the stock further automatically. Instead you need to edit the order and manually decrease the stock by clicking on the line item and then use the “Reduce stock” button:
- Reducing stock manually via “Reduce Stock” will set the stock below zero to negative values. For example from -2 to -3. Stock changes are normally recorded in the order notes. Reducing the stock like this with these options does not record the action in the order notes.
If you want to keep accepting orders and have your customers pay for them in advance, you need to allow backorders.
Setting the backorders option to “Allow, but notify customer” changes the scenario. Now the following is true:
- Changing the stock value in the backend now does not set the stock status. Because WooCommerce is now prepared to keep selling regardless of the inventory count, both values are not linked any longer.
- The product can be purchased from the front end. There is a notice above the add to cart button that signals that this is a backorder:
backorders =Allow, but notify customer
stock quantity = 0
stock status = in stock
- Backorders only are possible for as long as the stock status is “in stock”. Setting the product to out of stock will again block purchases and display “out of stock”.
- Customers can purchase the product and checkout as normal. They pay in full and every purchase will decrease the stock. The order will indicate that it is a backorder in the cart and checkout.
Thank you page indicating the backorder status.
- Viewing the order in the backend will provide similar information:
- Stock reductions are also recorded in the order notes:
- You can quickly view all backordered items by using this plugin: https://wordpress.org/plugins/woocommerce-backorders-report/ – it adds a simple overview located at WooCommerce -> Reports -> Stock -> On Backorder
Setting the backorders option to “Allow” produces the same scenario without the backorder labels.
The product is basically shown and treated as “in stock”. But the stock can be negative. However your customers get no signal that they are ordering on backorder.
The above mentioned plugin will still correctly count all backorders since WooCommerce adds a meta information to the order that flags it as a backorder.
The only difference here is that this information is output nowhere. It allows for “invisible” / discreet backorder function.
How to show a notice for when WooCommerce backorders are allowed
Here is a code snippet that allows you to add notices for when backorders are (not) allowed:
Third party applications
The relationship described above where stock quantity triggers stock status and backorders define their behaviour only works properly when the WordPress backend is used to do so, or if a purchase is made.
Keep in mind that values such as stock quantity, stock status and backorders can also be managed by third party applications via API calls and / or CLI commands. In which case the hooks that link stock quantity and stock status and other checks are bypassed.
This means a third party application (such as your fulfillments company) can possibly set a product to wonky configurations that are normally automatically checked and corrected by WooCommerce.
stock quantity = 0
stock status = in stock.
backorders = Do not allow
If you run into inconsistent stock behaviour then chances are that external commands only pass a value for stock quantity while neglecting to pass the stock status as well. Oftentimes the backorder values are completely ignored.
It is good practice to account for all three values whenever such a command is sent to WooCommerce. Check with your third party and ensure that the code that manages your WooCommerce stock does account for all three options so that wonky configurations do not come to pass.