Home » Magento, Magento 212 February 2016

Magento 2: Get Current Category & Current Product

This article shows how we can get current category and current product data in Magento 2.

Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Framework\Registry class in the constructor of my module’s block class.


Printing current category and current product in any template (.phtml) file

Using Object Manager

For more, see:


Hope this helps. Thanks.

Magento 2

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • minh hiep nguyen

    thank you

  • Liam Fielding

    You shouldn’t be using the object manager directly.

  • Attique Rehman

    Nice and simple

  • Antony Pinheiro

    How i get image url