Log in
Model

Rule

Magento\CatalogRule\Model\Rule

What it does

This class represents a catalog price rule in Magento 2, allowing merchants to apply discounts to products based on conditions like customer groups, dates, and product attributes.

Developers use this model to programmatically create, modify, or validate catalog price rules, calculate discounted prices for products, and determine which products match specific rule conditions.

It handles the business logic for rule validation, product matching, and price calculations before data is persisted through the resource model.

Public Methods

  • getConditionsInstance()
  • getActionsInstance()
  • getCustomerGroupIds()
  • getNow()
  • setNow()
  • getMatchingProductIds()
  • callbackValidateProduct()
  • validateData()
  • calcProductPriceRule()
  • setProductsFilter()
  • getProductsFilter()
  • afterSave()
  • reindex()
  • afterDelete()
  • isRuleBehaviorChanged()
  • getConditionsFieldSetId()
  • getRuleId()
  • setRuleId()
  • getName()
  • setName()
  • getDescription()
  • setDescription()
  • getIsActive()
  • setIsActive()
  • getRuleCondition()
  • setRuleCondition()
  • getStopRulesProcessing()
  • setStopRulesProcessing()
  • getSortOrder()
  • setSortOrder()
  • getSimpleAction()
  • setSimpleAction()
  • getDiscountAmount()
  • setDiscountAmount()
  • getFromDate()
  • getToDate()
  • getExtensionAttributes()
  • setExtensionAttributes()
  • getIdentities()
  • clearPriceRulesData()
  • _resetState()