Log in
Model

Rule

Magento\SalesRule\Model\Rule

What it does

This class represents a Shopping Cart Price Rule (Sales Rule) in Magento 2, managing promotional discounts applied to shopping carts.

Developers use this model to create, load, and validate cart price rules, handle coupon code generation and assignment, check rule conditions against quote addresses, and manage rule attributes like discount amounts, customer groups, date ranges, and usage limits.

Public Methods

  • loadRelations()
  • loadCouponCode()
  • afterSave()
  • loadPost()
  • getConditionsInstance()
  • getActionsInstance()
  • getCouponCodeGenerator()
  • setCouponCodeGenerator()
  • getPrimaryCoupon()
  • getCustomerGroupIds()
  • getStoreLabel()
  • getStoreLabels()
  • getCoupons()
  • getCouponTypes()
  • acquireCoupon()
  • getFromDate()
  • getSimpleAction()
  • getToDate()
  • hasIsValidForAddress()
  • setIsValidForAddress()
  • getIsValidForAddress()
  • getConditionsFieldSetId()
  • getActionsFieldSetId()