How to Add Multi Select Filter in Magento 2 Admin Grid

How to Add Multi Select Filter in Magento 2 Admin Grid

Have you ever needed a Magento 2 admin grid that is filterable by more column’s values, i.e. something from multiselect drop-down?

For example, you want to export customers with 3 different groups and you have to select a group thrice and export the data for all the 3 one by one. However, if you want to filter all 3 of them together, you cannot perform a single action as the default Magento 2 allows applying only one filter at a time.

If the business requirement demands to apply a mass action on products satisfying more than one condition, the solution below can be helpful.

Implement the below code to add multi select filter in Magento 2 admin grid as shown in the figure below:

How to Add Multi Select Filter in Magento 2 Admin Grid

Steps to Add Multi-Select Filter in Magento 2 Admin Grid:

  1. Add this code into ui_component’s grid xml file:
    for example : [Vendor]\[Module]\view\adminhtml\ui_component\my_first_grid.xml
  2. Create Status.php file at path [Vendor]\[Module]\Model\ProductImage\Status.php

That’s it.

Any doubts on the topic will be entertained in the Comments section below. I’d be happy to solve it.

Do share the solution with fellow developers via social media.


Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

(based on 14 Reviews)

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a reply:

Your email address will not be published.