Hello Magento Fellas ?,

The present-day subject matter is How to add Stock Status column in Admin Product Grid Magento 2 which is the loop article of How to add a Custom Column to the Products Grid of Magento 2.

In any case, you left out to go through our last article, here it is. How to change default Magento 2 Logo in Admin Panel. Let’s start with today’s topic ?

Managing stock helps to reduce the bounce rate. Notifying customers about the different stock statuses of products results in enhanced user experience. Magento 2 is a well-known E-commerce platform as it provides advanced features. And one such feature is adding a stock status column in the Admin Product grid. Let’s see How to add Stock Status column in Admin Product Grid Magento 2.

Steps to add Stock Status column in Admin Product Grid Magento 2:

Step 1: First, we need to create a “di.xml” file inside our extension on the following path:

app\code\Vendor\Extension\etc

 Now, add the below code: 

Step 2: After that, we need to create a “ProductDataProvider.php” file inside the below folder path of extension:

app\code\Vendor\Extension\Plugin\Ui\DataProvider\Product

Then add the below code:

Step 3: After that, we need to create a “product_listing.xml” file inside the below folder path of extension:

app\code\Vendor\Extension\view\adminhtml\ui_component

After that add the code as shown below: 

Step 4: After that, we need to create a “StockStatus.php” file inside the below folder path of extension:

app\code\Vendor\Extension\Ui\Component\Listing\Columns

Next, add the following code:  

Step 5: At last, we need to create the “Options.php” file inside the below folder path of extension:

app\code\Vendor\Extension\Ui\Component\Listing\Columns\StockStatus

And finally, add the code as mentioned below:

That’s all.

Final Words:

Accordingly, everyone has successfully carried out the steps to add Stock Status column in Admin Product Grid Magento 2. Besides this, display a custom message on the store frontend about product stock status with Custom Stock Status Extension for Magento 2.

For any hurdles, while implementing the code, let me know by mentioning in the comment part. Share the article with your fellow Magento friends. Keep in touch and keep developing!

Happy Coding ?

Click to rate this post!
[Total: 5 Average: 4.2]