> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Service Plugins ## Namespace: ecom-validations ## Article: Introduction ## Article Link: https://dev.wix.com/docs/velo/events-service-plugins/e-commerce/service-plugins/ecom-validations/introduction.md ## Article Content: # Introduction The Validations [service plugin](https://support.wix.com/en/article/velo-custom-app-extensions-using-spis) (formerly SPI) allows site owners and collaborators to validate a site visitor's cart and checkout. For example, you can validate a specific line item’s quantity if the quantity per order is limited. Site owners and collaborators can either write their own custom validation logic, or integrate with a 3rd-party validations provider. Wix eCommerce calls [`getValidationViolations()`](https://www.wix.com/velo/reference/spis/wix-ecom/ecom-validations/getvalidationviolations) to retrieve any violations in a site visitor's cart and checkout. The custom validation plugin code validates the request, and returns any validation violation data in a site visitor's cart and checkout (using the structure provided by Wix eCommerce). If there aren't any validation violations, the endpoint should return an object containing an empty array. Site visitors can see validation violations in their cart and checkout pages. For example, see the images below: The image below shows a cart page with both a general validation violation warning and a line item validation violation warning. ![Cart page warning](https://wixmp-833713b177cebf373f611808.wixmp.com/images/velo-images/media_ecom-validations-img1.png "Cart page warnings") The images below show a checkout page with both a general validation violation error and a line item validation violation error. The general violation error appears at the top of the checkout page: ![Checkout page errors - top](https://wixmp-833713b177cebf373f611808.wixmp.com/images/velo-images/media_ecom-validations-img2a.png "Checkout page errors") The error appears again above the **Place Order & Pay** button at the end of the page. The button is disabled until the errors are resolved. ![Checkout page errors - bottom](https://wixmp-833713b177cebf373f611808.wixmp.com/images/velo-images/media_ecom-validations-img3.png "Checkout page errors") For a step-by-step tutorial, see [Validation Violations service plugin](https://support.wix.com/en/article/tutorial-validations-custom-extension). Future functionality includes validating products and orders. ## Before you begin By default, the Validations service plugin only validates a site visitor's checkout. If you want to also validate a site visitor's cart, set the `validateInCart` parameter to `true` in the service plugin's config file. ## To add a service plugin 1. [Add the plugin to your site](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/integrations/custom-extensions-spis/custom-app-extensions-using-sp-is.md#step-1-create-a-new-extension-on-your-wix-site). 2. Update the [`getConfig()`](https://www.wix.com/velo/reference/spis/wix-ecom/ecom-validations/getconfig) function in the **-config.js** file that is added to your site during step 1. 3. Update the [`getValidationViolations()`](https://www.wix.com/velo/reference/spis/wix-ecom/ecom-validations/getvalidationviolations) function in the **.js** file that is added to your site during step 1. ## Use Cases With the Validations service plugin you can define the validations for a cart and checkout that fit your site's needs. Possible validations include: + Minimum subtotal amount to qualify for free shipping. + Age of a customer before they proceed to checkout. + Specific items to ship only to specific regions. + Restrict purchases to site members only. + Close checkout on certain days. ## Terminology | Term | Definition | | --- | --- | | Severity |How severe the violation is. The violations are shown on the cart and checkout pages. A warning is displayed as yellow, and allows a site visitor to proceed with caution. An error is displayed as red, and doesn't allow a site visitor to proceed with the eCommerce flow. | | Subscription Option |A store owner can create [subscriptions](https://support.wix.com/en/article/wix-stores-selling-product-subscriptions) to sell their products on a recurring basis. A line item can be a subscription. | | Target |Target location on a checkout or cart page where the violation will be displayed. The target violation can either be in a particular `lineItem`, or in an `other` area of the cart or checkout page. | | Violations |A list of any validation violations in a site visitor's cart or checkout. |