Promotions Configuration
Groups
Groups allow it to split sets of rules and attach conditions to them. This eases the design of promotions and improves the evaluation performance. For example allows this to create a group for the promotion rules which are shared between all stores and to create groups for individual shops, i.e. the store that have just opened.
When evaluation the configuration the promotion engine first merges the rules of all groups which either have no condition or for which the cart matches the condition, into a list of active rules.
Ranks
Ranks define the order of promotion rule evaluation and determine the strategy how the rules are applied. Each rule is linked to a rank.
When evaluating promotions configuration the engine groups the active rules according to their rank. The rules for each rank are then executed according to the evaluation mode. Each rule evaluation might change the cart, i.e. it adds a discount to the cart. Hence the order of the rule evaluation has great effect on the final result.
When evaluating the rules of a rank two modes can be used: selectBest
and applyAll
. The selectBest
only applies
the rule in rank which result in the maximal reduction of the total. The applyAll
mode just applies all rules one
after another.
Conditions
Compositions: and
and or
Compositions allow to build complex expressions. They can be freely nested. The supported compositions are: Conjunction
and
and disjunction or
.
Example: Match items with SKU "1", which are referred to by a coupon with id "coupon-id"
{
"type": "and",
"children": [
{
"type": "hasSKU",
"args": {
"equals": "1"
}
},
{
"type": "isReferredToByCoupon",
"args": {
"value": "coupon-id"
}
}
]
}
Predicate hasSKU
Match line items with the given or one of the given SKUs.
Name | Type | Optional | Description |
---|---|---|---|
equals | string | yes | Matched SKU |
oneOf | string[] | yes | List of SKUs |
Example:
{
"type": "hasSKU",
"args": {
"oneOf": ["1", "2"]
}
}
Predicate amountGreaterOrEqual
Match line items with amount greater or equal to the given value.
Name | Type | Optional | Description |
---|---|---|---|
value | integer | no | Amount |
Example: Match line items with amount greater two
{
"type": "amountGreaterOrEqual",
"args": {
"value": 2
}
}
Predicate isExclusiveForLineItem
Match line items for which no promotion was already applied.
Example:
{
"type": "isExclusiveForLineItem"
}
Predicate isReferredToByCoupon
Match line items which are referred by a not already redeemed coupon with the given id.
Name | Type | Optional | Description |
---|---|---|---|
equals | string | no | Id of the coupon |
Example:
{
"type": "isReferredToByCoupon",
"args": {
"value": "id"
}
}
Predicate hasAdditionalAttribute
Match line items based on additional attributes. Either by specifying included values through the equals
or oneOf
property. Or by excluding some values through the notEquals
or noneOf
property.
Name | Type | Optional | Description |
---|---|---|---|
name | string | no | Name of the attribute |
notEquals | string | yes | Excluded value |
noneOf | string[] | yes | List of excluded values |
equals | string | yes | Included value |
oneOf | string[] | yes | List of included values |
Example: Match line items with the property prodcut group set to "05"
{
"type": "hasAdditionalAttribute",
"args": {
"name": "productGroup",
"equals": "05"
}
}
Example: Exclude line items with the property product group either "05" and "10"
{
"type": "hasAdditionalAttribute",
"args": {
"name": "productGroup",
"noneOf": ["05", "10"]
}
}
Predicate hasLoyaltyCard
The customer presented a valid loyalty card.
Example:
{
"type": "hasLoyaltyCard"
}
Predicate hasCoupon
The cart contains a not redeemed coupon with the given id.
Name | Type | Optional | Description |
---|---|---|---|
equals | string | yes | Id of the matched coupon |
oneOf | string[] | yes | List of ids of matched coupons |
Example:
{
"type": "hasCoupon",
"args": {
"equals": "id"
}
}
Predicate hasCouponCode
The cart contains a not redeemed coupon with the given code.
Name | Type | Optional | Description |
---|---|---|---|
equals | string | yes | Code of the matched coupon |
oneOf | string[] | yes | List of codes of matched coupons |
Example:
{
"type": "hasCouponCode",
"args": {
"equals": "code"
}
}
Predicate totalGreaterThan
The total of the cart is greater than the given value.
Name | Type | Optional | Description |
---|---|---|---|
value | string | no | Total of the Cart |
Example:
{
"type": "totalGreaterThan",
"args": {
"value": "100"
}
}
Predicate totalGreaterThanOrEqual
The total of the cart is greater than or equal to the given value.
Name | Type | Optional | Description |
---|---|---|---|
value | string | no | Total of the Cart |
Example:
{
"type": "totalGreaterThanOrEqual",
"args": {
"value": "100"
}
}
Predicate discountableTotalGreaterThanOrEqual
The total of the discountable items of the cart is greater than or equal to the given value.
Name | Type | Optional | Description |
---|---|---|---|
value | string | no | Total of the Cart |
Example:
{
"type": "discountableTotalGreaterThanOrEqual",
"args": {
"value": "100"
}
}
Predicate hasShopID
Shop has the given id.
Name | Type | Optional | Description |
---|---|---|---|
equals | string | yes | Id of the shop |
oneOf | string[] | yes | List of ids of the matched shops |
Example:
{
"type": "hasShopID",
"args": {
"equals": "100"
}
}
Predicate hasExternalShopID
Shop has the given external id.
Name | Type | Optional | Description |
---|---|---|---|
equals | string | yes | Id of the shop |
oneOf | string[] | yes | List of ids of the matched shops |
Example:
{
"type": "hasShopID",
"args": {
"equals": "1012"
}
}
Predicate hasProductInCart
Match carts containing the given number of a product.
Name | Type | Optional | Description |
---|---|---|---|
equals | string | no | SKU of the matched product |
amount | integer | no | Number of products |
Example: Cart contains six of the product
{
"type": "hasProductInCart",
"args": {
"equals": "1",
"amount": 6
}
}
Predicate isCurrentlyActive
Match if the current time is in the given time range.
Name | Type | Optional | Description |
---|---|---|---|
from | string | no | Begin of the time range (Format RFC3339) |
to | string | no | End of the time range (Format RFC3339) |
Example:
{
"type": "isCurrentlyActive",
"args": {
"from": "2025-03-15T00:00:00+01:00",
"to": "2025-03-22T00:00:00+01:00"
}
}
Actions
Action: addCartDiscount
Grant a relative or absolute discount for the cart.
The discount is only granted to discountable line items and does not exceed the total price of the cart.
Name | Type | Optional | Description |
---|---|---|---|
name | string | no | Name of the discount created |
value | string | no | Discount granted |
absolute | boolean | no | Value represents an absolute discount or a relative discount in percent |
isMultiusable | boolean | no | Apply discount multiple times |
attributes | object | yes | Additional attributes added to the discount |
Example: Grant 10% discount on the cart
{
"type": "addCartDiscount",
"args": {
"name": "Opening Discount",
"value": "10",
"absolute": false,
"isMultiusable": false
}
}