WooCommerce’s default checkout fields come with basic built-in validations like checking that an email address is formatted correctly or that a required field isn’t left empty. But when your store collects custom data that follows a specific format, those defaults aren’t enough.
The Custom Validator feature in Checkout Field Editor for WooCommerce lets you define your own validation rules using Regular Expressions (RegEx). This gives you precise control over what a customer can enter in any custom field and stops invalid data from reaching your orders before it becomes a problem.
What Is a Custom Validator?
A custom validator is a pattern-based rule that checks whether a field’s input matches a format you define. If the input doesn’t match, the customer sees an error message you’ve written and cannot place the order until the value is corrected.
Custom validators are configured once in Advanced Settings and then become available as selectable options in the Validations dropdown whenever you create or edit a checkout field.
Each validator has four parts:

| Field | Description |
| Validator Name | A unique internal identifier for this rule (e.g., house_number). This is not visible to customers. |
| Validator Label | The display name shown in the Validations dropdown when editing a field (e.g., “House Number”). |
| Validator Pattern | The RegEx pattern the input must match. Must be prefixed with /^ and suffixed with $/. Example: /^[0-9]{5}$/ |
| Validator Message | The error message shown to the customer if validation fails. Use %s to include the field name dynamically. Example: %s Invalid house number |
How to Create a Custom Validator
- Go to WooCommerce → Checkout Form → Advanced Settings.
- Scroll to the Custom Validators section.
- Fill in the Validator Name, Validator Label, Validator Pattern, and Validator Message fields in the Custom validators row.
- To add more validators, click the + button to add a new row. To remove one, click the × button.
- Click Save Changes.
- Open any checkout field and the new validator will now appear in its Validations dropdown.
Use Case: Enforcing a Valid House Number Format
Consider a store that collects delivery addresses and has added a custom House Number field at checkout. Without a validation rule, customers can type anything into that field, letters, special characters, or leave it ambiguous and the order still goes through. This leads to failed deliveries and manual correction work for your team.
By creating a custom validator with the pattern /^[0-9]{5}$/, you ensure the field only accepts numeric house numbers up to five digits. If a customer enters “AB12” or “@@45”, they immediately see a message like “House Number must be a valid house number” and cannot proceed until it’s corrected. The right data reaches your fulfillment team every time.
Note: RegEx patterns must always be prefixed with /^ and suffixed with $/. Patterns missing these delimiters will not evaluate correctly. If you’re new to RegEx, regex101.com is a reliable tool to build and test your patterns before adding them here.
Getting Started
Block Checkout Field Editor
Advanced Settings
For Developers
Compatible Plugin & Themes
Frequently Asked Questions
How