Log in
Model

Item

Magento\Catalog\Model\Product\Compare\Item

What it does

This class manages individual items in a customer's product comparison list in Magento 2.

Developers use this model to add, load, and track products that customers want to compare, handling both logged-in customers and guests through visitor IDs.

It automatically syncs comparison data when customers log in or out, ensuring their comparison lists persist across sessions.

Public Methods

  • beforeSave()
  • addVisitorId()
  • loadByProduct()
  • addProductData()
  • getDataForSave()
  • bindCustomerLogin()
  • bindCustomerLogout()
  • clean()
  • getCustomerId()
  • getVisitorId()
  • getIdentities()