Log in
Model

Link

Magento\Catalog\Model\Product\Link

What it does

This class manages product relationships in Magento 2, including related products, up-sells, and cross-sells.

Developers use it to programmatically link products together, retrieve linked product collections, and save product relationship data.

It provides methods to set the link type and access link attributes for different relationship types.

Public Methods

  • useRelatedLinks()
  • useUpSellLinks()
  • useCrossSellLinks()
  • getAttributeTypeTable()
  • getProductCollection()
  • getLinkCollection()
  • getAttributes()
  • saveProductRelations()