Hello Magento Friends,

Today I will explain How to Add Category Column with Filter to the Admin Product Grid in Magento 2.

One of the key features of Magento 2 is its customizable admin interface, allowing store owners to tailor the system to meet their specific needs. By default, Magento 2’s Admin Product Grid provides essential information about products, such as SKU, name, price, and stock status. However, for store administrators dealing with a wide range of products, it becomes crucial to have additional information readily available, such as the category to which each product belongs. Adding a Category column with a filter can significantly improve the user experience and streamline product management tasks.

In this blog post, we will explore how to enhance the Admin Product Grid in Magento 2 by adding a Category column with a filter, providing administrators with a convenient way to manage products.

Steps to Add Category Column with Filter to the Admin Product Grid in Magento 2:

Step 1: Create a product_listing.xml file inside the view folder.

app\code\Vendor\Module\view\adminhtml\ui_component\

Then add the code as follows

Step 2: Now, create a Category.php file inside the view folder.

app\code\Vendor\Module\Ui\Component\Listing\Column\

Then include the code as given below

Step 3: Next, create Categorylist.php file inside etc folder.

app\code\Vendor\Module\Model\Category\

And add the below-mentioned code

Step 4: Then create di.xml file inside etc folder.

app\code\Vendor\Module\etc\

And add the following code snippet

Step 5: At last, create ProductDataProvider.php file inside etc folder.

app\code\Vendor\Module\Ui\DataProvider\Product\

Now include the below given piece of code

Output: 

You can see that the category has been added to the filter options in your Magento 2 admin.

Category filter

On selecting it, the category column will be displayed in the Magento 2 product admin grid.

category column

Conclusion:

Enhancing the Admin Product Grid in Magento 2 by adding a Category column with a filter provides a valuable tool for store administrators. This customization allows for more efficient product management, making it easier to organize and categorize a large inventory. By following the steps outlined in this blog post, you can empower your team to navigate the admin interface with greater ease and precision, ultimately improving the overall efficiency of your online store management.

Related Article – How to Filter by Multiple SKU on Admin Product Grid in Magento 2?

If you have any doubts, let me know through the comment section. Share the tutorial with your friends, and stay in touch with us for more.

Happy Coding!

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