i'm trying to show the categories in the top menu with the corresponding category description but can't find any function for that.

With the object manager i can get the id, name etc. but not the description.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

// get current store’s categories
$categoryHelper = $objectManager->get('\Magento\Catalog\Helper\Category');
$categories = $categoryHelper->getStoreCategories();

foreach ($categories as $category) {
echo $category->getId() . '<br />';
echo $category->getName() . '<br />';
print_r($category->getData());. '<br />';


Any idea how i can get each category description?

1 Answer 1

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$categoryFactory = $objectManager->create('Magento\Catalog\Model\ResourceModel\Category\CollectionFactory');

$categories = $categoryFactory->create()

foreach ($categories as $category) {

Info : I gave you this solution to guide you for getting what you need but, using the object manager is not a recommended way, use a block instead, you create some function getCategoryDescription() for exemple, then you get it in your phtml like this : $block->getCategoryDescription().

  • Awesome thank you! I did it how you said and got rid of the object manager and put it instead in a custom block in a separate module.
    – Rudolf
    Nov 7, 2018 at 15:34
  • Good job :) you're welcome !
    – PЯINCƎ
    Nov 7, 2018 at 15:39

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.