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.
A site visitor adds a coupon code to their Wix checkout.
Wix sends a Get Validation Violations service plugin request to your app.
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:
With this validation violation, the site visitor can't proceed with the checkout.
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.
When configuring your app, 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.
A site visitor adds 6 cases of white wine to their cart, which exceeds the quantity that is permitted for this line item.
Wix sends a Get Validation Violations service plugin request to your app.
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:
After this validation violation, the site visitor removes 1 case of white wine to proceed to Wix Checkout.
Again Wix sends a Get Validation Violations service plugin request to your app.
Your server validates the request and finds it successful. In this case, Wix eCommerce expects an object containing an empty list.