Tutorialsplane

Magento 2 get current Category Name


Magento 2 get current Category Name We can get current Category name by category object. Using object manager we can get current category details such as Category Name, Id etc.


How to get current Category Name,Id In Magento 2?

We can get currenct category details from registry simply as below-

Get Current category Name, Id Example:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');
    echo $category->getName();
    echo "<br/>";
    echo $category->getId();