I would like to add an extra column based on a product attribute <my_attribute_code> in the product grid that appears when editing a category in the section "Products In Category" ideally before the SKU Column

enter image description here

Is it possible?


Try following way to add a column. I have added a product creation time column as an example:


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <preference for="Magento\Catalog\Block\Adminhtml\Category\Tab\Product" type="SR\MagentoCommunity\Block\Adminhtml\Category\Tab\Product"/>


namespace SR\MagentoCommunity\Block\Adminhtml\Category\Tab;

class Product extends \Magento\Catalog\Block\Adminhtml\Category\Tab\Product
     * Set collection object
     * @param \Magento\Framework\Data\Collection $collection
     * @return void
    public function setCollection($collection)

     * @return $this
    protected function _prepareColumns()
        $this->addColumnAfter('created_at', array(
            'header' => __('Created At'),
            'index' => 'created_at',
        ), 'sku');

        return $this;
  • Thanks I'll try that and test :) – gabtzi May 22 at 12:24
  • It worked great. I was able to add my attribute like this :) Thank you very much – gabtzi May 22 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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