How to Setup Storefront Stock Quantity & Manage Inventory

WooCommerce Storefront Stock Quantity One of the features that should be added in your WooCommerce store is a standard way to display stock quantity on the product page.

WooCommerce, by default, allows you to manage inventory levels, but you cannot display the stock quantity on the product page. Once you have added products in your store, it is very easy to manage inventory in the product data section.

WooCommerce Storefront Stock Quantity

In the product data section, products can be managed to display stock quantity on the product page. In this tab, you can manually update inventory, adjust SKU details, and more.

For example, in the screenshot below, I am using a Simple product and have configured the product to track stock and allow backorders with customer notifications enabled. This section can be accessed via Products > All Products. Click on any product, and on the products page, you should see this:inventory tab

Managing the product’s stock at this level means setting the amount you have for all types of this product. The options are listed below:

  • SKU: Here, you can set a unique identifier for each product you sell.
  • Manage stock: This option determines if WooCommerce tracks the stock for the product. If you enable this option, the inventory is tracked at a product level, not a variation level.
  • Stock quantity: Here, you should enter the number of items you have in stock for this product. (It is only visible when Manage stock is enabled at a product level)
  • Allow backorders: This option determines how backorders are managed. The options are: ‘Do not allow’, ‘Allow, but notify customer’, ‘Allow’. (This is visible when Manage stock is enabled at a product level)
  • Stock Status: This option sets the current status of the product stock. (It is only visible when Manage stock is enabled at a product level)
  • Sold individually: If checked, this option can limit how many of the products a customer can buy at one time.

Managing Stock on Variable Product Types

If you deal with variable products in your WooCommerce store, you need to manage stock at a variation level instead of product level. If you manage a variable product at this level, your shop will know how many you have overall. You will not be aware of the specific amount of any given size.

Steps to Display Stock Quantity or Status on the WooCommerce Shop Page

Here are the steps that you need to take:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to add the function to display stock quantity or status on the woocommerce shop page.
  3. Add the following code to the PHP file:
/**
 *       Stock Quantity @ WooCommerce Shop / Cart / Archive Pages
*/
add_action( 'woocommerce_after_shop_loop_item', 'njengah_show_stock_shop', 10 );
function njengah_show_stock_shop() {
   global $product;
   echo wc_get_stock_html( $product );
}
  1. To see the outcome, refresh the product page, and you will see this:Stock Quantity

Conclusion

In this post, I have shared how you can manage the inventory level for simple products. By default, WooCommerce allows you to manage inventory levels, but you cannot display the product page’s stock quantity. However, I have shared a PHP code to show the stock quantity on the product page and the cart page.

Moreover, it is worth mentioning that you should consider hiring a developer if you are not familiar with handling code.

Similar Articles