Log in
Model

CategoryProductLink

Magento\Catalog\Model\CategoryProductLink

What it does

This class represents the relationship between a product and a category in Magento 2.

Developers use this model when working with category-product assignments through the API, particularly to get or set a product's SKU, its position within a category, and the category ID it belongs to.

It's commonly used in catalog operations that involve managing which products appear in which categories and in what order.

Public Methods

  • getSku()
  • getPosition()
  • getCategoryId()
  • setSku()
  • setPosition()
  • setCategoryId()
  • getExtensionAttributes()
  • setExtensionAttributes()