Creates a new discount rule.
You can only call this method when authenticated as a Wix app or Wix user identity.
Discount rule info.
Discount rule.
curl -X POST \
'https://www.wixapis.com/ecom/v1/discount-rules/create' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
--data-binary '{
"discountRule": {
"active": true,
"name": "15% on all products when buying more than 5 items",
"trigger": {
"itemQuantityRange": {
"scopes": [
{
"id": "all_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": []
}
}
],
"from": 5,
"to": null
},
"triggerType": "ITEM_QUANTITY_RANGE"
},
"discounts": {
"values": [
{
"targetType": "SPECIFIC_ITEMS",
"specificItemsInfo": {
"scopes": [
{
"id": "all_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogItemIds": [],
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
}
}
]
},
"discountType": "PERCENTAGE",
"percentage": 15
}
]
}
}
}'
{
"discountRule": {
"id": "f6a7b058-62c3-44aa-a23a-e6d0898dcdc2",
"revision": "1",
"createdDate": "2023-06-27T09:33:04.796Z",
"updatedDate": "2023-06-27T09:33:04.796Z",
"active": true,
"name": "15% on all products when buying more than 5 items",
"trigger": {
"itemQuantityRange": {
"scopes": [
{
"id": "all_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": []
}
}
],
"from": 5
},
"triggerType": "ITEM_QUANTITY_RANGE"
},
"discounts": {
"values": [
{
"targetType": "SPECIFIC_ITEMS",
"specificItemsInfo": {
"scopes": [
{
"id": "all_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": []
}
}
]
},
"percentage": 15,
"discountType": "PERCENTAGE"
}
]
},
"status": "LIVE",
"usageCount": 0
}
}
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.