Add Custom Attribute in getData of Eav Collection magento 2

If you need to add a custom attribute to add in collection getData array. you need to add it in filter of addAttributeToFilter. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollection = $objectManager->create(‘Magento\Product\Model\Product\ResourceModel\CollectionFactory’)->create(); $productCollection->create()->addAttributeToFilter(‘custom_attr’, …