ThemeHigh
  • Plugins
  • Documentation
  • Support
  • Partners
  • Login
  • Getting Started
    • Overview...
    • Add/Edit Custom Sections
    • Add/Edit Custom Fields
    • Add Display Styles
    • Set Tooltip Details
    • Price Fields & Types
    • Set Display Rules for Fields & Sections
    • How to Export/Import Fields & Sections Individually
  • Advanced Settings
    • Add Price Table
    • How to modify add to cart button text?
    • Add a Custom Validation Rule
    • Add a Confirm Field Validator
    • Choose a Layout Style
    • Disable "Enhanced Select(Select 2)" for select fields
    • How to post extra options as URL Parameters?
    • Use the Div tag for displaying fields
    • Backup & Import Settings
    • WPML String Translations...
  • FAQ
    • Frequently Asked Questions...
  • For Developers
    • Hooks & References...
  • Compatible Plugin & Themes
    • Plugins & Themes...

Documentation/Extra Product Option for WooCommerce/How to Add a Custom Validation Rule?

How to Add a Custom Validation Rule?

Last updated on September 4, 2023

Custom validation features are used to define validation rules using Regular Expressions. All these custom validators will be available in the Validations drop-down to set validations when creating or editing product fields.

To create new custom validators:

    1. Navigate to the Advanced Settings tab (WooCommerce → Extra Product Option → Advanced Settings)
    2. From the sections Custom validators, create new validators by providing all the required values.Custom_Validators.png
      • Validator Label: The display name for the validation rule
      • Validator Pattern: A regular expression, which is used to match a valid input. The regular expression must be prefixed with /^ and suffixed with $/. Eg: /^[0-9]{5}$/
      • Validator Message: The message to be displayed when the validation fails. Use %s to include the field name in the validation messages.
    3.  Once added required validators, click on the Save changes button.
    4. The newly created validators will be available to choose from the Validations drop-down.

 

Quick Links

  • Try Demo
  • How to Download and Install Our Plugin ?
  • Manage License
  • Join our Facebook Community

This article posted in Advanced Settings, Extra Product Option for WooCommerce, Pro Documentation

Leave a Reply Cancel reply

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

ThemeHigh

We develop innovative WordPress plugins and themes for e-commerce and other WordPress websites.

Resources
  • Documentation
  • Support
  • Blog
  • Bestsellers
  • Affiliates
  • Partners
Policy Information
  • Terms & Conditions
  • Privacy Policy
  • Support Policy
  • Refunds Policy
  • Licenses
Security
Payment Options

© 2025 ThemeHigh. All rights reserved.

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