Promotions
How to set up promotions with the Rules Engine using order rules
Example
curl -g -X POST \
'https://yourdomain.commercelayer.io/api/flex_promotions' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"data": {
"type": "flex_promotions",
"attributes": {
"name": "Personal promotion",
"starts_at": "2018-01-01T12:00:00.000Z",
"expires_at": "2018-01-02T12:00:00.000Z",
"rules": {
"rules": [
{
"name": "10% Promo T-shirt x2",
"conditions": [
{
"field": "order.line_items.sku.code",
"matcher": "eq",
"value": "PROMOTSHIRT",
"nested": {
"conditions": [
{
"field": "order.line_items.quantity",
"matcher": "gteq",
"value": 2
}
]
}
}
],
"actions": [
{
"type": "percentage",
"selector": "order",
"value": "0.1"
}
]
}
]
}
}
}
}'Available actions
PercentageFixed priceFixed amountFree giftBuy X pay YEvery X discount Y
Check and validation
Examples
Matching order
Non-matching order
Use cases
Promotions
Last updated