How to Show Stock Remaining Items in Magento 2

How to Show Stock Remaining Items in Magento 2

Table of Contents

It is really necessary to notify customers about the remaining items at the online shopping stores. Although the section of this message is small, it is very meaningful to customers and significant to online stores. In this article, we will find out how to show Stock Remaining Items in Magento 2.

Recommend:

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 focus on purchasing plan to get their loved items. They can prepare good 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>") ?>
</div>
<?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.

EXPLORE MAGEPLAZA CUSTOM STOCK STATUS

This comes to the end of our article guide How to Show Stock Remaining Items in Magento 2. Hope the article will be helpful to your store!

Comments for How to Show Stock Remaining Items in Magento 2



People also searched for

Subscribe

Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

comment
iphone
go up