Frontend | Backend | Api

Discounts\Models\Frontend\ProductCondition

Product condition describes the conditions that need to be met for the discount to be applied; based on product quantity or price that is in the current cart. Set "quantityTo" value to 0 to "exclude" the product from the cart; i.e. when the added product is in the cart, the discount is not applied.

Method Description Returns
getProductCodes() Gets the product codes for this condition. array
getQuantityFrom() Gets a minimum quantity of the product that needs to be in the cart to apply the discount. int
getQuantityTo() Gets a maximum quantity of the product that can be in the cart to apply the discount. Can be 0 to exclude the product from the cart. int
isAllowed() Checks if the condition set to allow a product. If is allowed when not forbidden. bool
isForbidden() Checks if the condition set to forbid a product. It is forbidden when either "quantity to" or "amount to" are set to 0. bool
getAmountFrom() Gets a minimum price amount of the product that needs to be in the cart to apply the discount. string
getAmountTo() Gets a maximum price amount of the product that can be in the cart to apply the discount. string
getDisplayType() Returns the nice name of a condition type string
getType() Returns the type of condition string
getSnakeType() Returns the type of condition in the snake case format: lowercase and connected by underline string
getSlugType() Returns the type of condition in the slug format: lowercase and connected by hyphen string
getId() int
getName() string
getData() array
isActive() bool
getCreated() Date the record was created. DateTime
getModified() Last modification date for the record. DateTime
getRule() Rule
isNewRecord() Check if the record is a new record bool
isHierarchicalModel() Check whether a model is a hierarchical model, i.e. can have children bool
isVersionedModel() Check whether a model is versioned bool