A validation is an action that checks whether input data meets specified requirements. This guide introduces field validation, and cart and checkout validation, and describes the available resources that you can use to build validations in Shopify checkout.
How it worksAnchor link to section titled "How it works"
You can build functionality in your app that enables merchants to provide the following experiences:
Field validationAnchor link to section titled "Field validation"
You can use a checkout UI extension to validate fields at checkout.
Field validation at checkout can enable merchants to block customers from proceeding in the checkout when they haven't met certain conditions. For example, a merchant can prevent customers from checking out if the customer tries to ship to a PO box, or if the customer is less than 18 years old.
The following example shows a process of gathering and validating user input using checkout UI components, and then blocking customer progress in the checkout:
Cart and checkout validationAnchor link to section titled "Cart and checkout validation"
You can use Shopify Functions to ensure that purchases meet certain criteria before a customer can check out or complete an order. For example, you might want to enforce an order maximum for customers with insufficient order history, and prevent them from proceeding through checkout.
The following example shows a validation error in checkout:
Getting startedAnchor link to section titled "Getting started"
Follow these tutorials to get started with validating fields at checkout, or validating an entire cart and checkout.
Developer tools and resourcesAnchor link to section titled "Developer tools and resources"
Explore the following developer tools and resources to get familiar with building validations in checkout.
Checkout UI extensions API reference
Consult the API reference for checkout UI extension points and their respective types.
Components for checkout UI extensions
Learn about the components that are available in checkout UI extensions.
Checkout extension configuration
Learn about the properties that you can configure in your checkout UI extension.
- Use a checkout UI extension to validate fields at checkout and block customer progress.
- Use Shopify Functions to block progress on a checkout when the cart line quantities exceed a limit.