Log in
Model

Validator

Magento\SalesRule\Model\Validator

What it does

This class validates and applies shopping cart price rules (sales rules) to quotes in Magento 2.

Developers use it to calculate discounts on cart items and shipping based on configured promotion rules, coupon codes, and customer groups.

It handles all discount types including percentage, fixed amount, buy X get Y, and cart-level discounts.

Public Methods

  • _resetState()
  • init()
  • initFromQuote()
  • getRules()
  • setSkipActionsValidation()
  • canApplyRules()
  • reset()
  • process()
  • processShippingAmount()
  • initTotals()
  • getItemPrice()
  • getItemOriginalPrice()
  • getItemBasePrice()
  • getItemBaseOriginalPrice()
  • prepareDescription()
  • sortItemsByPriority()
  • getRuleItemTotalsInfo()
  • decrementRuleItemTotalsCount()
  • canApplyDiscount()