Social Icons

twitterfacebookgoogle pluslinkedinemail

Sunday 4 September 2016

How to get current category details on listing page - magento 2

Hello Friends,

Here is the code to get details of current category in magento 2.

Please add below code in list.phtml (or you want any page of catalog) and you will get the category details in magento 2.


$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');//get current category
var_dump($category->getData());

You will get output like this

 

Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement