Log in
Helper

DefaultCategory

Magento\Catalog\Helper\DefaultCategory

What it does

This helper class provides access to Magento's default root category ID, which is typically 2.

Developers use this when they need to reference or work with the default category in programmatic operations, such as filtering products or building category trees.

It's particularly useful for ensuring consistency when referencing the base category across different parts of the application.

Public Methods

  • getId()