Last active
February 20, 2021 21:51
-
-
Save danichim/63f51f41273bbbf898ea1185a4192ee1 to your computer and use it in GitHub Desktop.
check number and country at checkout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_checkout_process', 'check_phone_number_length'); | |
function check_phone_number_length() { | |
global $woocommerce; | |
if ( !(preg_match('/^[0-9]{10}$/D', $_POST['billing_phone'] )) && $_POST['billing_country'] == 'RO') { | |
wc_add_notice( "<strong>Telefon</strong> Număr incorect ! Trebuie să conțină 10 cifre" ,'error' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment