Advertisement
Fany_VanDaal

Validace čísla popisného v adrese

May 25th, 2021
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. /* od Martin Šturcel */
  2. /* Validace zda je zadáno číslo popisné v adrese v pokladně */
  3. add_action( 'woocommerce_after_checkout_validation', 'mpca86_validate_address_1', 10, 2);
  4. function mpca86_validate_address_1( $fields, $errors ){
  5.  
  6.     if ( ! preg_match( '/[0-9]/', $fields[ 'billing_address_1' ] )  ){
  7.         $errors->add( 'validation', 'V poli ulice jste nezadali číslo popisné. Je adresa správně?' );
  8.     }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement