POST

Create Discount Rule


Creates a new discount rule.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage eCommerce - all permissions
Manage Stores - all permissions
Manage Restaurants - all permissions
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/ecom/v1/discount-rules

Body Params
discountRuleDiscountRuleRequired

Discount rule info.

Response Object
discountRuleDiscountRule

Discount rule.

Request
cURL
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 } ] } } }'
Response
JSON
{ "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 } }
Errors
428Failed Precondition

There is 1 error with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Event TriggersThis method triggers the following events:
Did this help?