In Magento, grids play a vital role when it comes to displaying data in an efficient way. This kind of grid is responsible for listing database items to display in a managed way. Also, it helps to sort or updating data items quickly as per the requirements of the admin. There are many default grids available in Magento 2 like product grid, order grid, review grid etc. But sometimes you require to have a custom column or parameter to make things easy for you.
Also, Magento allows you to quickly add a column to the product grid if a value that you want to display in the column is a product attribute using products grid toolbar under Columns control. Moreover, to personalized grid elements, you just check/uncheck items. But what if you want to display custom values that aren’t available as a product attribute you need to manually code for it.
Here is a small piece of code to do the same.
Firstly, create product_listing.xml file at this location.

After that we need to override ProductDataProvider by creating di.xml file in below folder.

Next, we need to create Addstockstatus.php file inside below folder along with this bottom code.

Lastly, don’t forget to clean cache using below command

That’s it! Now you can see a new column added to grid from your Magento 2 backend. Also, you are free to play and manipulate this according to your need for adding one or more elements to the grid.
Let us know if you are facing an issue while implementing using this code by commenting below.
Happy Coding!

[Total: 10   Average: 4.9/5]