How to get product custom attribute in product grid. I have create product attribute as "qty_per_box". But it is not showing in collection.

The following code is not getting custom product attribue.

    * @return Grid
        protected function _prepareCollection()
            $collection = $this->productFactory->create()->getCollection()->addAttributeToSelect("*");
            return parent::_prepareCollection();

1 Answer 1


1/ Magento Admin > Stores > Attributes / Product > Click on your custom attribute > Advanced Attribute Properties > Set "Add to Column Options" to "Yes" and click on "Save attribute" button

enter image description here

2/ Magento Admin > Products > Inventory / Catalog > Select your custom attribute on "Columns box"

enter image description here

  • I am showing product grid in custom module. I have created product attribute as swatch option. In product gird it is returning the option value. But I want to get option text.
    – Abhishek
    Commented Mar 1, 2017 at 16:55

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.