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
}
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.