Confirm field validators come in handy while there is a particular field that is to be compared with another field to ensure they match. This feature helps to validate two fields for the same value (for example Email and Confirm Email) while placing an order. This validation is assigned to any particular field which will be verified and validated before placing the order.
To create confirm validators:
- Navigate to Advanced Settings tab (WooCommerce → Checkout Form → Advanced Settings)
- From the section Custom validators, create new Confirm field validators by providing all the required values.
A unique name for the validation rule, which will be used internally to identify the validator.
The display name for the validation rule.
The field in which the value has to be compared with.
The message to be displayed when the validation fails. Use %s to include the field name in the validation message.
- Click on the Save changes button.
- The newly created validators will be available to choose in the Validations drop-down. confirm-validator-select.png.
- Confirm field validators will trigger only when there is value in the confirmation field. So please mark the confirmation field as required.