Magento 2: Add New Column in Admin Product Grid

ktoberfest 2019 - 10.17.19 - 6pm - SaturdayHoward & Patrick's - New York City (3)

We can add a new custom column in admin product grid by using product_listing.xml.

Let's create a file view\adminhtml\ui_component\product_listing.xml with the following content:

<?xml version="1.0"?>
<!--
/**
* @copyright Copyright (c) 2016 www.magebuzz.com
*/
-->
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="product_columns" class="Magento\Catalog\Ui\Component\Listing\Columns">
       <column name="custom_field">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="add_field" xsi:type="boolean">true</item>
                    <item name="label" xsi:type="string" translate="true">Custom Field</item>
                    <item name="sortOrder" xsi:type="number">75</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>

Finally, clear cache and check results.

When conducting these above steps, if you meet any problems, be free to ask us by writing comments under the lesson.

One thought on “Magento 2: Add New Column in Admin Product Grid”

1 Response to Magento 2: Add New Column in Admin Product Grid

  • DRAJI

    Hi,

    Its working fine.I have added category column. Can we add category filter in admin product grid?

Comments