I need to add custom column and filter in the customer grid in Magento 2 admin. The column attribute is from different modules. There are many solutions for sales order grid, but none (or incomplete) for customer grid.

I had the same issue, so I found the solution by myself. The solution is in the answer.

3 Answers 3


Here is the module i have created.


  • I don't have any custom table now, I just created an attribute in the customer, and created a customer_listing.xml and a data provider, so that case how can I use this with out any custom table
    – Naveenbos
    Nov 23, 2018 at 5:55
  • fix the issues it has some fatal errors
    – HaFiz Umer
    Sep 27, 2019 at 11:29

you can add custom column in customer grid by this


path : app\code\vender\module\view\adminhtml\ui_component\

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
   <columns name="customer_columns" class="Magento\Customer\Ui\Component\Listing\Columns">
    <column name="custom_columns_name_same_as_field_in_db">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="sortOrder" xsi:type="number">55</item>
                <item name="filter" xsi:type="string">text</item>
                <item name="label" translate="true" xsi:type="string">My Custom Column</item>


path : app\code\vender\module\Ui\Component\Listing\


namespace vender\module\Ui\Component\Listing;

class CustomerDataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult
    protected function _initSelect()
            ['custom_table_name' => $this->getTable('custom_table_name')],
            'main_table.entity_id = custom_table_name.customer_id',
        return $this;


path : app\code\vender\module\etc

<?xml version="1.0" encoding="utf-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Customer\Model\ResourceModel\Grid\Collection" type="Magento\Customer\Model\ResourceModel\Grid\Collection2" />
    <virtualType name="Magento\Customer\Model\ResourceModel\Grid\Collection2" type="Tatva\Corerewrite\Ui\Component\Listing\CustomerDataProvider">
            <argument name="mainTable" xsi:type="string">customer_grid_flat</argument>
            <argument name="resourceModel" xsi:type="string">Magento\Customer\Model\ResourceModel\Customer</argument>
  • I have already tried this solution but it didn't work. So, i made module which worked for me.
    – Ankit8
    Aug 3, 2018 at 6:27
  • 2
    what is Magento\Customer\Model\ResourceModel\Grid\Collection2 Dec 4, 2019 at 17:06

@Hiren, thx for this solution that works on magento 2.2, but doesn't not work since I've upgrade to 2.4. Now I have an error : Call to undefined method {vendor}\Customer\Ui\Component\Listing\CustomerDataProvider\Interceptor::addFullTextFilter() Exception in /home/www/website/www/vendor/magento/module-customer/Ui/Component/Listing/FulltextFilter.php:32

Any Ideas ?

Edit : to be sharper the error occurs when I made a search.

  • 1
    If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review Apr 9, 2023 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.