docs: improved commerce modules [4/n] (#9517)
Improve pricing, product, and promotion modules docs [4/n]
This commit is contained in:
@@ -10,7 +10,7 @@ In this document, you’ll learn about the main promotion and rule concepts in t
|
||||
|
||||
## What is a Promotion?
|
||||
|
||||
A promotion, represented by the [Promotion data model](/references/promotion/models/Promotion), represents a discount applied on cart items, shipping methods, or entire orders.
|
||||
A promotion, represented by the [Promotion data model](/references/promotion/models/Promotion), is a discount that can be applied on cart items, shipping methods, or entire orders.
|
||||
|
||||
A promotion has two types:
|
||||
|
||||
@@ -72,15 +72,23 @@ A promotion has two types:
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
---
|
||||
|
||||
## PromotionRule
|
||||
|
||||
A promotion can be restricted by a set of rules, each rule is represented by the [PromotionRule data model](/references/promotion/models/PromotionRule). For example, you can create a promotion that only customers of the `VIP` customer group can use.
|
||||
A promotion can be restricted by a set of rules, each rule is represented by the [PromotionRule data model](/references/promotion/models/PromotionRule).
|
||||
|
||||
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.
|
||||
A `PromotionRule`'s `attribute` property indicates the property's name to which this rule is applied.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
@@ -90,8 +98,8 @@ The `PromotionRule`'s `operator` property adds more flexibility to the rule’s
|
||||
|
||||
For example, to restrict the promotion to only `VIP` and `B2B` customer groups:
|
||||
|
||||
- Add a `PromotionRule` with its `attribute` property set to `customer_group_id` and `operator` property to `in`.
|
||||
- Add two `PromotionRuleValue` associated with the rule: one with the value `VIP` and the other `B2B`.
|
||||
- Add a `PromotionRule` record with its `attribute` property set to `customer_group_id` and `operator` property to `in`.
|
||||
- Add two `PromotionRuleValue` records associated with the rule: one with the value `VIP` and the other `B2B`.
|
||||
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user