Created
April 25, 2017 03:37
-
-
Save digitalchild/074ccd8f9c9c017bd2e8d7ca0910fdfd to your computer and use it in GitHub Desktop.
check address
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
<?php | |
add_action( 'woocommerce_checkout_process', 'address_has_number'); | |
function address_has_number() { | |
$billing_address_1 = $_POST[ 'billing_address_1' ]; | |
if ( preg_match('/^\d/', $billing_address_1 ) === 1 ){ | |
wc_add_notice( __( 'Your address does not have a number.' ), 'error' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment