Log in
Helper

Compare

Magento\Catalog\Helper\Product\Compare

What it does

This helper class manages product comparison functionality in Magento 2, allowing customers to add, remove, and compare products side-by-side.

Developers use it to generate URLs for compare actions, retrieve the collection of compared products, track item counts, and manage compare list operations across customer sessions and guest visitors.

Public Methods

  • getListUrl()
  • getPostDataParams()
  • getAddUrl()
  • getAddToWishlistParams()
  • getAddToCartUrl()
  • getRemoveUrl()
  • getPostDataRemove()
  • getClearListUrl()
  • getPostDataClearList()
  • getItemCollection()
  • calculate()
  • getItemCount()
  • hasItems()
  • setAllowUsedFlat()
  • getAllowUsedFlat()
  • setCustomerId()