Confirm field validators come handy while there is a particular field which is to be compared with another field to ensure they match. This feature helps to validate two fields for the same value (for example Name and Confirm the Name) while placing an order. This validation is assigned to any particular field which will be verified and validated before placing the order.
Please follow the simple steps given below to set up a confirm field validator.
To create new custom validators,
Go to Checkout Form > Advanced Settings page. You can see a section Confirm Field Validators with 4 fields showing Validator Name, Validator Label, Field Name, and Validator Message.
Fill the fields according to your requirements. In the Field Name box, give the name of the first field with the value which should be equal for the field on which the validation is to be applied. (For example, if the values entered in the fields billing_name and shipping_name should be same, give ‘billing_name’ as Field Name.)
Setup a new confirm field validation rule as in below example screenshot.
Validator Name: A unique name for the validation rule, which will be used internally to identify the validator.
Validator Label: The display name for the validation rule.
Field Name: The field which the value has to be compared with.
Error Message: The message to be displayed when the validation fails. Use %s to include field name in validation messages.
Newly created validators will be available to choose in Validations drop-down.
Confirm field validators will trigger only when there is value in the confirmation field. So please mark the confirmation field as required.