Web Analytics

Fill the form & Get Installation Support

How to get category count in Magento 2?

You can get the total category count for the store in Magento 2 by using the getCount() method.

You can fetch that information from
Magento\Catalog\Api\CategoryManagementInterface.

All you need to do is just create a simple Model class which will help you to retrieve the total number of the category.  Code is as per below.

Once you done with the code part, you can call method by using below command,

$categoryCount = $this->getCategoryCount();

That’s it.

Fill the below form if you have any Magento programming need.





    Recent Articles

    Author Info

    Author Image

    Magento Developer

    Hire G. Patel

    Get a Free Quote





      /* second popup */

      Connect With Us