I have created a new category attribute using a setup script and now it is showing on the backend and assigned values (it is just a boolean attribute). the attribute name on EAV entity table is
is_home_category
.And now I'm trying to get its values on frontend
$categories = $this->getStoreCategories(true, true, true); foreach ($categories as $category): echo $category->getIsHomeCategory() endforeach;
But it only returns NULL , how can I get my custom category attribute on the frontend
Solved! Go to Solution.
Instantiate a category collection manually and call its addAttributeToSelect method.
thank you very much I have inject
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollection
and able to load category collection with
public function getCategoryCollection()
    {
        $collection = $this->_categoryCollection->create()
            ->addAttributeToFilter('is_home_category', '1');
        return $collection;
    }and Now I can call
getIsHomeCategory()
method but I can not get category name by getName() do you know how to get category name ?
my bad  it should be
 it should be 
public function getCategoryCollection()
    {
        $collection = $this->_categoryCollection->create()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('is_home_category', '1');
        return $collection;
    }and thanks again