Log in
Model

ProductCategoryList

Magento\Catalog\Model\ProductCategoryList

What it does

This class retrieves all category IDs that a product belongs to across all stores in Magento 2.

Developers use it when they need to determine which categories contain a specific product, such as for breadcrumb generation, product filtering, or category-based logic.

It queries both the main category-product relation table and store-specific indexer tables to ensure complete category associations.

Public Methods

  • getCategoryIds()
  • getCategorySelect()
  • _resetState()