Search
 
SCRIPT & CODE EXAMPLE
 

PHP

woocommerce validar campos personalizados en el checkout

add_action( 'woocommerce_after_checkout_validation', 'misha_validate_fname_lname', 10, 2);
 
function misha_validate_fname_lname( $fields, $errors ){
 
    if ( preg_match( '/d/', $fields[ 'billing_first_name' ] ) || preg_match( '/d/', $fields[ 'billing_last_name' ] )  ){
        $errors->add( 'validation', 'Your first or last name contains a number. Really?' );
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel , How can I increment and decrement value with unique id 
Php :: php preg_replace callback 
Php :: php check how long a function took to exexute 
Php :: Generating Random String In PHP Using Brute Force 
Php :: docker php-fpm 
Php :: PHP ord — Convert the first byte of a string to a value between 0 and 255 
Php :: avoid sql injection in password field 
Php :: php get last date of month 
Php :: php receive get 
Php :: laravel form collective add asterisk 
Php :: How to Filter Your Posts & Pages by Custom Field in WordPress Dashboard 
Php :: PHP: how to "clone from" another object of same class 
Php :: Laravel 9.x Terminal can not migrate table 
Php :: waht is middleware in laravel 
Php :: PHP SSRF Wrapper/URL Schema 
Php :: php usort two columns 
Php :: php objects 
Php :: wordpress how to string multple function.php files together 
Php :: function to fetch user details 
Php :: laravel many to many 
Php :: post_export signals 
Php :: how to show image in easyadmin 3 index page 
Php :: Number in English Words (Indian format) php 
Php :: laravel-websockets 403 forbidden error 
Php :: set additional params to form laravel 
Php :: Reference — What does this symbol mean in PHP? 
Php :: An expression was expected phpmyadmin 
Php :: auto reload page in chat php 
Php :: Only Show Specific Countries In Caldera Forms Phone Field 
Php :: session flash data (old input) 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =