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

Attributes
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 supported values:
UNDEFINEDLIVEEXPIREDPENDING
Discount rule status.

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

PostCreate Discount Rule

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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.Authorization header required - pass the OAuth Access Token

Syntax

POST
https://www.wixapis.com/ecom/v1/discount-rules

Event Triggers

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

GetGet Discount Rule

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a discount rule.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Read eCommerce - all read permissions
Learn more about permission scopes.Authorization header required - pass the OAuth Access Token

Syntax

GET
https://www.wixapis.com/ecom/v1/discount-rules/{discountRuleId}

Was this helpful?
Yes
No

DeleteDelete Discount Rule

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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.Authorization header required - pass the OAuth Access Token

Syntax

DELETE
https://www.wixapis.com/ecom/v1/discount-rules/{discountRuleId}

Event Triggers

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

PatchUpdate Discount Rule

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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.Authorization header required - pass the OAuth Access Token

Syntax

PATCH
https://www.wixapis.com/ecom/v1/discount-rules/{discountRule.id}

Event Triggers

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

PostQuery Discount Rules

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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 eCommerce - all permissions
Read eCommerce - all read permissions
Learn more about permission scopes.Authorization header required - pass the OAuth Access Token

Syntax

POST
https://www.wixapis.com/ecom/v1/discount-rules/query

Was this helpful?
Yes
No

Discount Rule Created

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a discount rule is created.

Permissions

ECOM.DISCOUNT_RULES_READ
Learn more about permissions.

Event Body

Event 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

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a discount rule is updated.

Permissions

ECOM.DISCOUNT_RULES_READ
Learn more about permissions.

Event Body

Event 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

Developer Preview - This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a discount rule is deleted.

Permissions

ECOM.DISCOUNT_RULES_READ
Learn more about permissions.

Event Body

Event 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