About Discount Rules API

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:

Before you begin

  • Currently only item-level discounts are supported. Discounts for an entire cart/checkout are not yet supported.
  • Up to 5 triggers can be chained together.

Terminology

  • 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.

    • Discounts must have a defined scope/s
  • Scope: A group of catalog items that qualify for a discount.

    • Every catalog has up to 2 scopes "out of the box". For example, Wix Stores has Specific Products and All Products scopes.
    • Scopes are required in default triggers and discount objects.
    • Triggers and discounts can have multiple 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.

    • Default triggers: These built-in triggers fire when a specified minimum/maximum item quantity (for example, "at least 5 items") or cart subtotal ("no more than $100") is reached. For this trigger to fire, the items must also be part of a defined scope.
    • Custom triggers: Using the Custom Trigger Integration SPI you can provide any set of conditions you want. For example, a trigger that only fires for grey items, or only between 8pm-10pm on Mondays and Thursdays.
Was this helpful?
Yes
No

Discount Rule Object

Manage Discount Rules.

Properties
idstringRead-onlyformat GUID
Discount rule ID.

revisionobjectRead-only
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.

createdDatestringRead-onlyformat date-time
Date and time the discount rule was created.

updatedDatestringRead-onlyformat date-time
Date and time the discount rule was last updated.

activeboolean
Whether the discount rule is active. Default: true

namestringminLength 1maxLength 50
Discount rule name.

triggerobject
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.

activeTimeInfoobject
Time frame in which the discount rule is active.

discountsobject
List of discounts that are applied when one or more triggers are met. Currently, a discount rule can apply only 1 discount.

statusstringRead-only
4 enum supported values:
UNDEFINEDLIVEEXPIREDPENDING
Discount rule status.

usageCountintegerRead-only
Number of times the discount rule was used.
Was this helpful?
Yes
No

PostCreate Discount Rule

Creates a new discount rule.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Endpoint
POST
https://www.wixapis.com/ecom/v1/discount-rules

Event TriggersThis method triggers the following events:
Was this helpful?
Yes
No

GetGet Discount Rule

Retrieves a discount rule.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Stores - all read permissions
Manage eCommerce - all permissions
Learn more about permission scopes.
Endpoint
GET
https://www.wixapis.com/ecom/v1/discount-rules/{discountRuleId}

Was this helpful?
Yes
No

DeleteDelete Discount Rule

Deletes a discount rule.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Endpoint
DELETE
https://www.wixapis.com/ecom/v1/discount-rules/{discountRuleId}

Event TriggersThis method triggers the following events:
Was this helpful?
Yes
No

PatchUpdate Discount Rule

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.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Endpoint
PATCH
https://www.wixapis.com/ecom/v1/discount-rules/{discountRule.id}

Event TriggersThis method triggers the following events:
Was this helpful?
Yes
No

PostQuery Discount Rules

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.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Stores - all read permissions
Manage eCommerce - all permissions
Learn more about permission scopes.
Endpoint
POST
https://www.wixapis.com/ecom/v1/discount-rules/query

Was this helpful?
Yes
No

Discount Rule Created

Triggered when a discount rule is created.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Stores - all read permissions
Manage eCommerce - all permissions
Learn more about permission scopes.
Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Data
idstring
Unique event ID. Allows clients to ignore duplicate webhooks.

entityFqdnstring
Fully qualified domain name of the entity associated with the event. Expected wix.ecom.discounts.v1.discount_rule.

slugstring
Event name. Expected created.

entityIdstring
ID of the entity associated with the event.

eventTimestringformat date-time
Event timestamp.

triggeredByAnonymizeRequestboolean
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).

originatedFromstring
If present, indicates the action that triggered the event.

createdEventobject
Event information.
Was this helpful?
Yes
No

Discount Rule Updated

Triggered when a discount rule is updated.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Stores - all read permissions
Manage eCommerce - all permissions
Learn more about permission scopes.
Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Data
idstring
Unique event ID. Allows clients to ignore duplicate webhooks.

entityFqdnstring
Fully qualified domain name of the entity associated with the event. Expected wix.ecom.discounts.v1.discount_rule.

slugstring
Event name. Expected updated.

entityIdstring
ID of the entity associated with the event.

eventTimestringformat date-time
Event timestamp.

triggeredByAnonymizeRequestboolean
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).

originatedFromstring
If present, indicates the action that triggered the event.

updatedEventobject
Event information.
Was this helpful?
Yes
No

Discount Rule Deleted

Triggered when a discount rule is deleted.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Stores - all read permissions
Manage eCommerce - all permissions
Learn more about permission scopes.
Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Data
idstring
Unique event ID. Allows clients to ignore duplicate webhooks.

entityFqdnstring
Fully qualified domain name of the entity associated with the event. Expected wix.ecom.discounts.v1.discount_rule.

slugstring
Event name. Expected deleted.

entityIdstring
ID of the entity associated with the event.

eventTimestringformat date-time
Event timestamp.

triggeredByAnonymizeRequestboolean
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).

originatedFromstring
If present, indicates the action that triggered the event.

deletedEventstruct
Event information.
Was this helpful?
Yes
No