The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

How to Show Stock Remaining Items in Magento 2

If you keep receiving questions about remaining stocks, it is time for you to update this information on the website. Although the section of this message is small, it is very meaningful to customers when they can find the information easily, and significant to online stores because it can reduce their workload of replying to customers’ stock concerns. In this article, we will find out how to show Stock Remaining Items in Magento 2.


Table of Contents

Why is telling customers about stock remaining items important?

Make customers trust more about the “HOT” level of a product

Let’s imagine that when you are shopping online and you see the label “Hot”, “Bestseller” but have no idea about the availability of products. This definitely makes you feel confused and somehow feel suspicious about the level of “Hot” in these items.

In this case, the message such as “Only 5 items available”, “Hurry up! Only 2 items left” definitely confirm firmly about the popularity of an item.

“HOT” level of a product

As the urging tool to motivate customers quickly make purchases

There is the truth that shoppers tend to rush to collect items when they feel worried other ones will pick all of them. It means that the smaller the item quantity is, the more hurried the shoppers are. Therefore, notifications about the limitation of items will work effectively to motivate the purchasing decision.

Better information, Better purchase plan

When customers are notified about the small availability of their concerned products, they will feel more focused on purchasing plan to get their loved items. They can prepare well about time to order, money to purchase and more.

Professionalize store appearance

Such a simple but significant message to customers is somehow showing professional notification system in a store. Customers can have good experience from such small but meaningful care.

How to set up “Only 2 items left in stock” message

In this article, we will guide you the way to get the Qty left in stock of a particular product in Magento 2. Let’s take an example as “Only 2 items left in stock”.

Please follow these stages:

Stage 1: Configure “Only 2 left”

  • Step 1: On the Admin Panel, go to Stores > Settings > Configuration
  • Step 2: On the left panel, go to Catalog > Inventory
  • Step 3: Enter the number as 2 in the Display X left Threshold field. In the Store View, “Only 2 left” will be shown to the buyer.

Stage 2: Custom the above message to “Only 2 items left in stock”

Follow the path: \vendor\magento\module-catalog-inventory\view\frontend\templates\stockqty\default.phtml

Rewrite by the code below:

<?php if ($block->isMsgVisible()): ?>
<div class="availability only" title="<?= /* @escapeNotVerified */ __('Only %1 item(s) left in stock', ($block->getStockQtyLeft())) ?>">
<?= /* @escapeNotVerified */ __('Only %1 item(s) left in stock', "<strong>{$block->getStockQtyLeft()}</strong>") ?>
<?php endif ?>

Following the stages above, you will get the custom message “Only 2 items left in stock”. However, by Magento default, we can use the above option for simple products since we maintain the inventory for simple products.

An easy solution to custom any message

If you are not familiar with complicated coding, and would like to save time, or make the notice more attractive and lively, Custom Stock Status extension is recommended as the wise solution with a very easy and simple configuration. Custom Stock Status will help your store to custom the remaining message in the best way with extra advanced functions and definitely meet all your expectations. Let’s take a look at some typical features of Custom Stock Status:

Create unlimited custom stock status

Custom Stock Status help you to custom the stock notice with any messages you want without any limitation

Create unlimited custom stock status

Add image/icon to beautify the notice

Beside custom the message freely, with Custom Stock Status, you also can beautify the label to make it lively by adding any image you want.

Add image/icon to beautify the notice

Switch stock labels when quantity changes

An interesting feature of Custom Stock Status is applying specific stock status label automatically depending on the change in product quantity ranges. For example, if the quantity of a product is 1 to 10, the stock status will be “Hurry up! Last items.’’ However, when product quantity drops below 1, the stock notification will be automatically switched to notification - ‘In Stock in 5 Days’.

Switch stock labels when quantity changes

Applicable to all product types

With Custom Stock Status, you can customize the labels for all types of products including Simple products, Configurable products, Group products, Bundle products

Applicable to all product types

To sum up, Magento 2 Custom Stock Status exactly meets the demand for customizing the stock label with all advanced functions. An effective stock label by Custom Stock Status will not only be clear at the content but also impressive at the look.

Custom Stock Status

Custom Stock Status for Magento 2

Provide customers with product availability by allowing store owners to add any stock status to any item.

Check it out!

The bottom line

The default Magento 2 allows you to display remaining items on your site if you follow these instructions. However, it is limited with certain product types and quite hard to customize the design to excel the results. That is why we provide you with our Custom Stock Status solution with amazing features shown as above. Hope the article will be helpful to your store, and see you in our next posts!

Image Description
Hello, I'm the Chief Technology Officer of Mageplaza, and I am thrilled to share my story with you. My deep love and passion for technology have fueled my journey as a professional coder and an ultra-marathon runner. Over the past decade, I have accumulated extensive experience and honed my expertise in PHP development.

Looking for
Customization & Development Services?

8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.

Get free consultant
development service

    Explore Our Products:

    People also searched for


    Stay in the know

    Get special offers on the latest news from Mageplaza.

    Earn $10 in reward now!

    Earn $10 in reward now!

    go up