Log in
Model

ListCompare

Magento\Catalog\Model\Product\Compare\ListCompare

What it does

This class manages the product comparison feature in Magento 2, allowing customers to add, remove, and view products in their comparison list.

Developers use this model when implementing custom comparison functionality, processing compare list actions in controllers, or accessing a customer's compare items in templates and blocks.

Public Methods

  • addProduct()
  • addProducts()
  • getItemCollection()
  • removeProduct()
  • hasItems()