ThemeHigh
  • Plugins
  • Bundles
  • Resources
    Documentation Documentation Step-by-step guides to set up and help you understand our plugins with ease. Blog Blog Tips, insights, and ideas from the team to help you grow your e-commerce store.
  • Resources
    Documentation
    Documentation

    Step-by-step guides to set up and help you understand our plugins with ease.

    Blog
    Blog

    Tips, insights, and ideas from the team to help you grow your e-commerce store.

  • Support
  • Login
  • Getting Started
    • Plugin Installation
    • Overview
    • Date, Time & Related Field Settings
    • Import/Export Checkout Fields
    • Managing Checkout Fields
    • Managing Checkout Section
    • Set Display Rules
    • Set Repeat Rules
    • Price Fields & Types
    • User Meta Data & Order Meta Data
    • Display Custom Fields
  • Classic and Block Checkout Editor
    • Classic and Block Checkout Editor
    • Why Your Checkout Fields Aren’...
  • Block Checkout Field Editor
    • Block Checkout Field Editor
  • Advanced Settings
    • Custom Fields in Address Format
    • Enable Address Autofill
    • Configure Locale Override Settings
    • Add Custom Fields to CSV Export
    • Display Custom Fields In PDF Invoices & Packing Slips
    • Zapier Support
    • Country, State, Province based Conditions
    • WPML Compatibility
    • Backup & Import Settings
    • Enhanced Select (Select2) for Select Fields
    • Enable Wrap Custom Sections with Div
    • Enable Heading/Label Field
    • Enable Review Panel Conditions
    • Enable Inline Validation in Chec...
    • Enable Conditional Rules Based Payment & Shipping Methods
    • WPML String Translations...
    • Add a New Custom Validation Rule
    • Add a New Confirm Field Validator
  • For Developers
    • Hooks & References...
    • Display Rules: Use cases and mor...
    • Repeat Rules: More use cases and...
    • Based on Checkout Fields: Use ca...
    • Override HTML Content: Examples...
    • Compatibility with “WooCom...
  • Compatible Plugin & Themes
    • Plugins & Themes...
  • Frequently Asked Questions
    • Frequently Asked Questions...
  • How
    • How To Display Fields In Order D...
    • How To Customise The Shipping Se...
    • How To Add Custom Fields In The ...
    • How to Add Custom Price Fields o...
    • How To Add A New Section To The ...
    • How To Display Custom Fields In ...
    • How to Show/Hide Fields Based On...
    • How To Set Repeat Rules On The C...

Documentation/Checkout Field Editor for WooCommerce/How to Add a New Custom Validation Rule?

How to Add a New Custom Validation Rule?

Last updated on June 15, 2026

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

  1. Go to WooCommerce → Checkout Form → Advanced Settings.
  2. Scroll to the Custom Validators section.
  3. Fill in the Validator Name, Validator Label, Validator Pattern, and Validator Message fields in the Custom validators row.
  4. To add more validators, click the + button to add a new row. To remove one, click the × button.
  5. Click Save Changes.
  6. 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.


Get the plugin

On this page

  • What Is a Custom Validator?
  • How to Create a Custom Validator

What's new

  • Added a custom file upload button property for the File upload field type.
  • Alert on selecting display position of sections as before/after terms and conditions.
  • Added Woocommerce 6.8.2 compatibility.

Highlights

  • 24 custom field types with file upload.
  • Create additional sections.
  • Display sections and Fields Conditionally.
  • Display custom fields at 14 different positions.
  • Create confirm field validators.
  • Price fields with a set of price types.
  • Repeat fields and sections based on specific conditions.
  • WPML Compatibility.
  • Import & Export fields and sections.

This article posted in Advanced Settings, Checkout Field Editor for WooCommerce, Pro Documentation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

ThemeHigh

Driven by a deep passion for crafting thoughtful solutions, we aim to make WooCommerce store customization an easy and enjoyable experience for our users.

© 2026 ThemeHigh. All rights reserved.

Terms and conditions, features, support, pricing, and service options subject to change without notice.