About the Custom Discount Triggers Service Plugin

As a discount trigger provider, you can integrate with Wix to provide a merchant's stores or businesses with custom triggers that specify when a discount applies on the site's cart and checkout pages. Together with discount rules, custom triggers define the necessary conditions for a discount to apply. For example, a trigger that only fires between 4pm-6pm on Mondays through Thursdays.

The integration is done via an app in the Wix App Market and by implementing the Custom Discount Triggers service plugin. After the app is installed on a site, Wix triggers a call to your service whenever actions are performed on the cart or checkout entities/pages. For example, when adding an item to the cart.

Using the service plugin, you can design your app to:

  • Offer a happy hour discount.
  • Offer a sale on digital products.

Before you begin

To use a custom trigger to apply a discount, you must first create a discount rule. Create an automatic discount using the dashboard, or by using the Discount Rules API.

Get started

Follow these steps to begin implementing your service plugin.

Choose a framework

You can implement this service plugin with the following frameworks:

Configure your service plugin

To configure and customize your plugin, you need to provide important information in the service plugin configuration file. You can configure your plugin in the Wix Dev Center. For details, see Custom Discount Trigger Extension Configuration.

Define handler functions

Use customTriggers.provideHandlers() to define the following handler functions that implement your custom business logic. Make sure you define all required functions.

FunctionRequired
getEligibleTriggers()Yes
listTriggers()Yes

Code examples

Below is an example for implementing the Custom Discount Triggers service plugin in your code.

CLI: Basic code structure

This is the basic code structure for implementing the Custom Discount Triggers service plugin with the Wix CLI:

Copy

Self-hosted: Basic code structure

This is the basic code structure for implementing a self-hosted Custom Discount Triggers service plugin:

Copy

See also

Did this help?

Extension Config


To configure and customize your service plugin, you need to provide important details in the plugin.json configuration file.

Note

If you created your service plugin extension with the CLI, required fields are automatically populated for you.

Configuration Params
deploymentUristring

Required. Base URI where the endpoints are called. Wix appends the endpoint path to the base URI. For example, to call the Get Eligible Triggers endpoint at https://my-discount-app.com/v1/getEligibleTriggers, the base URI you provide here is https://my-discount-app.com/.

Did this help?