Frontend | Backend | Api

Discounts\Models\Frontend\ProductCategoryCondition

Product category condition describes the conditions that need to be met for the discount to be applied, based on product category quantity or price that is in the current cart. Set "quantityTo" or "amountTo" values to 0 to "exclude" the product category from the cart; i.e. when the added product of that category is in the cart, the discount is not applied. NOTE if you exclude several categories, not to apply discount product(s) that belong to all of these categories, need to be in the cart: if you restricted PCs and Laptops categories, to fail condition, you need product(s) that belong to PCs and to Laptops on the cart.

Method Description Returns
getProductCategoryIds() Gets the product category IDs for this condition. array
getQuantityFrom() Gets a minimum quantity of products (from the selected categories) that needs to be in the cart to apply the discount. int
getQuantityTo() Gets a maximum quantity of products (from the selected categories) that can be in the cart to apply the discount. Can be 0 to exclude any product (from the selected categories) from the cart. int
isAllowed() Checks if the condition set to allow a product category. If is allowed when not forbidden. bool
isForbidden() Checks if the condition set to forbid a product category. It is forbidden when either "quantity to" or "amount to" are set to 0. bool
getAmountFrom() Gets a minimum price of products (from the selected categories) that needs to be in the cart to apply the discount. string
getAmountTo() Gets a maximum price of products (from the selected categories) 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