Cart and Checkout Validation
Block checkout with custom error messages — order limits, address rules, customer restrictions and any rule you can express in JavaScript.
var errors = [];
if (parseFloat(input.cart.cost.totalAmount.amount) > 5000) {
errors.push({ message: 'Orders above 5000 are not allowed', target: '$.cart' });
}
return errors;Return value
return { operations: [{ validationAdd: { errors: errors } }] };Error targets
Target
Where it's shown
Run on — checkout steps
Step
When your code runs
Examples
Notes
Last updated