Validation Violations: Sample Use Cases & Flows

This article presents sample flows your app can support. You aren't limited to this exact flow, but it can be a helpful jumping off point as you plan your Validations integration.

Validate a coupon code for a Wix checkout

  1. A site visitor adds a coupon code to their Wix checkout.

  2. Wix sends a Get Validation Violations service plugin request to your app.

  3. Your server validates the request. If the coupon code is valid, the validation is sucessful and the service plugin returns an object containing an empty list. If the coupon isn't valid, the validation isn't successful. In this case, Wix eCommerce expects an object containing the validation violations, and the severity and target of the violations.

    Example of a violations response from your app:

    Copy
    1
  4. With this validation violation, the site visitor can't proceed with the checkout.

Validate a line item's quantity

In this flow, due to limited quantity of white wine, a site visitor can't add more than 5 cases of white wine to their cart.

App configuration prerequisites

When configuring your app in the Wix Developers Center, use these sample settings:

When configuring your app in the Wix Developers Center, set the validateInCart property to true in the extension’s configuration file. This validates a site visitor's cart in addition to a site visitor's checkout.

The flow

  1. A site visitor adds 6 cases of white wine to their cart, which exceeds the quantity that is permitted for this line item.

  2. Wix sends a Get Validation Violations service plugin request to your app.

  3. Your server validates the request and finds it unsuccessful. Wix eCommerce expects an object containing the validation violations, and the severity and target of the violations.

    Example of a violations response from your app:

    Copy
    1
  4. After this validation violation, the site visitor removes 1 case of white wine to proceed to Wix Checkout.

  5. Again Wix sends a Get Validation Violations service plugin request to your app.

  6. Your server validates the request and finds it successful. In this case, Wix eCommerce expects an object containing an empty list.

Was this helpful?
Yes
No