Log in
Model

Compare

Magento\Quote\Model\Quote\Item\Compare

What it does

This class compares two quote items to determine if they represent the same product with identical options.

Developers use this when adding products to cart to check if an item should be merged with an existing cart item or added as a separate line item.

It handles complex option comparison including serialized JSON values while filtering out non-relevant data like quantity and related products.

Public Methods

  • compare()
  • getOptions()