Anchor to Cart and Checkout Validation Function APICart and Checkout Validation Function API
Cart and checkout validation implements checks and rules to ensure that orders meet specific criteria before allowing customers to proceed with their purchase. This includes express checkouts, such as Shop Pay, PayPal, Google Pay, and Apple Pay. To validate a cart and checkout, server-side, you can only use the Cart and Checkout Validation Function API.
Shopify Functions enables you to customize Shopify's backend logic. The Cart and Checkout Validation Function API integrates this logic into the checkout flow.
Use the API to generate the validations and to specify the message that should be displayed in checkout when the Function returns a validation error. You can specify the checkout fields to target with the validation error message, and the cart as a global object to target with a validation error message.
Anchor to Use casesUse cases
- Use tokengating or require a customer membership at checkout.
- Verify the age or ID of a customer when they proceed through checkout.
- Provide B2B product minimums, maximums, and multiples.
- Provide B2B location order minimums, maximums, or credit limits.
- Specify quantity limits in a flash sale.
- B2B: Supported
- Cart: Supported
- Checkout: Supported
- Create Order API: Not supported
- Draft Order (Admin): Supported
- Draft Order (Checkout): Supported