The Wix eCommerce Discount Rules API allows you to create and manage discount rules. Discount rules are sets of triggers and scopes that together define the necessary conditions for a discount to apply to items in the cart/checkout.
With the Discount Rules API, you can:
Discount rule: A set of conditions (scope and trigger) that dictate whether an item qualifies for a specified discount.
Discount: The change applied to an item's price when conditions are met. Discounts can reduce an item's price by percentage or a specified amount, and also by setting an item to a fixed price.
Scope: A group of catalog items that qualify for a discount.
Specific Products
and All Products
scopes.Trigger: A set of conditions that must be met for a discount to become applicable. Triggers can be chained so that more than 1 condition must be met.
Manage Discount Rules.
Discount rule ID.
Revision number, which increments by 1 each time the discount rule is updated.
To prevent conflicting changes, the current revision
must be passed when updating the discount rule.
Date and time the discount rule was created.
Date and time the discount rule was last updated.
Whether the discount rule is active.
Default: true
Discount rule name.
Discount rule trigger.
A set of conditions that must be met for the discounts
to be applied.
Not passing a trigger will cause the discount to always apply.
Time frame in which the discount rule is active.
List of discounts that are applied when one or more triggers are met.
Notes:
Discount rule status.
Number of times the discount rule was used.
{
"id": "15bac455-10d0-4478-8358-e06f697f6180",
"revision": "8",
"createdDate": "2022-08-07T08:12:22.347Z",
"updatedDate": "2022-08-09T07:45:44.044Z",
"active": true,
"name": "My Amazing 10% Discount",
"trigger": {
"and": {
"triggers": [
{
"subtotalRange": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
],
"from": "100",
"to": null
},
"triggerType": "SUBTOTAL_RANGE"
},
{
"itemQuantityRange": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
],
"from": 5,
"to": null
},
"triggerType": "ITEM_QUANTITY_RANGE"
}
]
},
"triggerType": "AND"
},
"activeTimeInfo": {
"start": "2022-08-07T08:11:00Z",
"end": "2022-08-11T07:43:00Z"
},
"discounts": {
"values": [
{
"targetType": "SPECIFIC_ITEMS",
"specificItemsInfo": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
]
},
"percentage": 10,
"discountType": "PERCENTAGE"
}
]
},
"status": "LIVE",
"usageCount": 6
}
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:
See the entire list and learn more about Wix errors.
Retrieves a discount rule.
You can only call this method when authenticated as a Wix app or Wix user identity.
ID of the discount rule to retrieve.
The requested discount rule.
curl 'https://www.wixapis.com/ecom/v1/discount-rules/15bac455-10d0-4478-8358-e06f697f6180' \
-H 'Authorization: <AUTH>'
{
"id": "15bac455-10d0-4478-8358-e06f697f6180",
"revision": "8",
"createdDate": "2022-08-07T08:12:22.347Z",
"updatedDate": "2022-08-09T07:45:44.044Z",
"active": true,
"name": "My Amazing 10% Discount",
"trigger": {
"and": {
"triggers": [
{
"subtotalRange": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
],
"from": "100",
"to": null
},
"triggerType": "SUBTOTAL_RANGE"
},
{
"itemQuantityRange": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
],
"from": 5,
"to": null
},
"triggerType": "ITEM_QUANTITY_RANGE"
}
]
},
"triggerType": "AND"
},
"activeTimeInfo": {
"start": "2022-08-07T08:11:00Z",
"end": "2022-08-11T07:43:00Z"
},
"discounts": {
"values": [
{
"targetType": "SPECIFIC_ITEMS",
"specificItemsInfo": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
]
},
"percentage": 10,
"discountType": "PERCENTAGE"
}
]
},
"status": "LIVE",
"usageCount": 6
}
Deletes a discount rule.
You can only call this method when authenticated as a Wix app or Wix user identity.
ID of the discount rule to delete.
curl -X DELETE \
'https://www.wixapis.com/ecom/v1/discount-rules/delete/c31f8d152077bab24065f01c0e3152b746c54ce0' \
-H 'Authorization: <AUTH>'
{}
Updates a discount rule.
Each time the discount rule is updated, revision
increments by 1. The existing revision
must be included when updating the discount rule.
This ensures you're working with the latest discount rule information, and it prevents unintended overwrites.
You can only call this method when authenticated as a Wix app or Wix user identity.
Discount rule ID.
Discount rule info.
Updated discount rule.
curl -X PATCH \
'https://www.wixapis.com/ecom/v1/discount-rules/update/35120105-1327-4624-8f7f-2720dcbab4d6' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
--data-binary '{
"discountRule": {
"id": "35120105-1327-4624-8f7f-2720dcbab4d6",
"name": "discount new name",
"revision": "5"
}
}'
{
"discountRule": {
"id": "35120105-1327-4624-8f7f-2720dcbab4d6",
"revision": "6",
"createdDate": "2022-08-08T07:46:16.487Z",
"updatedDate": "2022-08-08T07:46:16.487Z",
"active": true,
"name": "discount new name",
"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",
"activeTimeInfo": null,
"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
}
}
}
Query discount rules using WQL (Wix Query Language).
Total entries (pagingMetadata.total
) will be returned only for the first page.
Note: discountRule.status
can't be used for querying.
You can only call this method when authenticated as a Wix app or Wix user identity.
Query options.
List of discount rules.
Details on the paged set of results returned.
Query Discount rules by active and start date fields, sorted by name
curl -X POST \
'https://www.wixapis.com/ecom/v1/discount-rules/query' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
--data-binary '{
"query": {
"sort": [
{
"fieldName": "name",
"order": "ASC"
}
],
"filter": {
"active": true,
"activeTimeInfo.start": {
"$gt": "2021-08-01T00:00:00Z"
}
},
"cursorPaging": {
"limit": 2
}
}
}'
{
"discountRules": [
{
"id": "15bac455-10d0-4478-8358-e06f697f6180",
"revision": "8",
"createdDate": "2022-08-07T08:12:22.347Z",
"updatedDate": "2022-08-09T07:45:44.044Z",
"active": true,
"name": "10% discount when buying over 100$ and 5 items",
"trigger": {
"and": {
"triggers": [
{
"subtotalRange": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
],
"from": "100",
"to": null
},
"triggerType": "SUBTOTAL_RANGE"
},
{
"itemQuantityRange": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
],
"from": 5,
"to": null
},
"triggerType": "ITEM_QUANTITY_RANGE"
}
]
},
"triggerType": "AND"
},
"activeTimeInfo": {
"start": "2022-08-07T08:11:00Z",
"end": "2022-08-11T07:43:00Z"
},
"discounts": {
"values": [
{
"targetType": "SPECIFIC_ITEMS",
"specificItemsInfo": {
"scopes": [
{
"id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CATALOG_ITEM",
"catalogItemFilter": {
"catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"catalogItemIds": [
"f150b16a-79ef-ef81-50f9-22e2df631822",
"187a07f6-b670-0650-c891-d60aeb797ee0"
]
}
}
]
},
"percentage": 10,
"discountType": "PERCENTAGE"
}
]
},
"status": "LIVE",
"usageCount": 1
},
{
"id": "35120105-1327-4624-8f7f-2720dcbab4d6",
"revision": "40",
"createdDate": "2023-02-28T11:56:05.996Z",
"updatedDate": "2023-04-02T08:34:37.998Z",
"active": false,
"name": "10$ off Duffle Bags",
"trigger": null,
"activeTimeInfo": {
"start": "2023-02-28T11:55:00Z",
"end": null
},
"discounts": {
"values": [
{
"targetType": "SPECIFIC_ITEMS",
"specificItemsInfo": {
"scopes": [
{
"id": "collections_215238eb-22a5-4c36-9e7b-e7c08025e04e",
"type": "CUSTOM_FILTER",
"customFilter": {
"appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
"params": {
"collectionIds": [
"c31f8d152077bab24065f01c0e3152b746c54ce0"
]
}
}
}
]
},
"fixedAmount": "10",
"discountType": "FIXED_AMOUNT"
}
]
},
"status": "LIVE",
"usageCount": 6
}
],
"pagingMetadata": {
"count": 2,
"offset": null,
"total": 8,
"cursors": {
"next": "c21acd2f5eb388517dd9c781a9ba42b9e51ca540.ElAqTgo-ChRhY3RpdmVUaW1lSW5mby5zdGFydBImKiQKIgoDJGd0EhsqGQoXCgokdGltZXN0YW1wEgkRAAAAKvCvd0IKDAoGYWN0aXZlEgIgACIkMzUxMjAxMDUtMTMyNy00NjI0LThmN2YtMjcyMGRjYmFiNGQ2",
"prev": null
}
}
}
Triggered when a discount rule is created.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.ecom.discounts.v1.discount_rule
.
Event name. Expected created
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.ecom.discounts.v1.discount_rule_created",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
{
"entityId": "18b3a857-131e-47b1-8748-3c4d362511f3",
"entityEventSequence": "1",
"slug": "created",
"id": "44a04c22-73cb-457c-96fd-ef4438e84490",
"createdEvent": {
"entity": {
"usageCount": 0,
"name": "15% on all products when buying more than 5 items",
"revision": "1",
"id": "18b3a857-131e-47b1-8748-3c4d362511f3",
"status": "LIVE",
"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"
}
]
},
"offer": "15% off\nAll products",
"updatedDate": "2023-06-28T12:43:22.739Z",
"createdDate": "2023-06-28T12:43:22.739Z",
"active": true,
"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"
}
}
},
"entityFqdn": "wix.ecom.discounts.v1.discount_rule",
"eventTime": "2023-06-28T12:43:22.747473Z",
"triggeredByAnonymizeRequest": false
}
Triggered when a discount rule is updated.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.ecom.discounts.v1.discount_rule
.
Event name. Expected updated
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.ecom.discounts.v1.discount_rule_updated",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
{
"entityId": "18b3a857-131e-47b1-8748-3c4d362511f3",
"entityEventSequence": "2",
"slug": "updated",
"id": "656ddf67-99fc-44ab-b3b1-6f99623328fd",
"entityFqdn": "wix.ecom.discounts.v1.discount_rule",
"updatedEvent": {
"currentEntity": {
"usageCount": 0,
"name": "New discount name",
"revision": "2",
"id": "18b3a857-131e-47b1-8748-3c4d362511f3",
"status": "LIVE",
"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"
}
]
},
"offer": "15% off\nAll products",
"updatedDate": "2023-06-28T12:51:41.482Z",
"createdDate": "2023-06-28T12:43:22.739Z",
"active": true,
"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"
}
}
},
"eventTime": "2023-06-28T12:51:41.489714Z",
"triggeredByAnonymizeRequest": false
}
Triggered when a discount rule is deleted.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.ecom.discounts.v1.discount_rule
.
Event name. Expected deleted
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.ecom.discounts.v1.discount_rule_deleted",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
{
"entityId": "18b3a857-131e-47b1-8748-3c4d362511f3",
"slug": "deleted",
"id": "14129e3b-30e9-496f-ab3f-90d1ca82899e",
"entityFqdn": "wix.ecom.discounts.v1.discount_rule",
"deletedEvent": {
"movedToTrash": true
},
"eventTime": "2023-06-28T12:53:01.736091Z",
"triggeredByAnonymizeRequest": false
}