- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Promotion Concepts
In this document, you’ll learn about the main promotion and rule concepts in the Promotion Module.
What is a Promotion?#
A promotion, represented by the Promotion data model, is a discount that can be applied on cart items, shipping methods, or entire orders.
A promotion has two types:
standard
: A standard promotion with rules.buyget
: “A buy X get Y” promotion with rules.
|
|
---|---|
A coupon code that gives customers 10% off their entire order. | Buy two shirts and get another for free. |
A coupon code that gives customers $15 off any shirt in their order. | Buy two shirts and get 10% off the entire order. |
A discount applied automatically for VIP customers that removes 10% off their shipping method’s amount. | Spend $100 and get free shipping. |
PromotionRule#
A promotion can be restricted by a set of rules, each rule is represented by the PromotionRule data model.
For example, you can create a promotion that only customers of the VIP
customer group can use.
A PromotionRule
's attribute
property indicates the property's name to which this rule is applied.
For example, customer_group_id
. Its value is stored in the PromotionRuleValue
data model. So, a rule can have multiple values.
When testing whether a promotion can be applied to a cart, the rule's attribute
property and its values are tested on the cart itself.
For example, the cart's customer must be part of the customer group(s) indicated in the promotion rule's value.
Flexible Rules#
The PromotionRule
's operator
property adds more flexibility to the rule’s condition rather than simple equality (eq
).
For example, to restrict the promotion to only VIP
and B2B
customer groups:
- Add a
PromotionRule
record with itsattribute
property set tocustomer_group_id
andoperator
property toin
. - Add two
PromotionRuleValue
records associated with the rule: one with the valueVIP
and the otherB2B
.
In this case, a customer’s group must be in the VIP
and B2B
set of values to use the promotion.