Validation
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 works
Anchor link to section titled "How it works"You can build functionality in your app that enables merchants to provide the following experiences:
Field validation
Anchor 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 validation
Anchor 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 started
Anchor 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 resources
Anchor link to section titled "Developer tools and resources"Explore the following developer tools and resources to get familiar with building validations in checkout.
- 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.