Created
January 19, 2021 08:24
-
-
Save daveloodts/1a78a9575f7b8151c06512b4d1cb9ca3 to your computer and use it in GitHub Desktop.
This file contains 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
// Check if address field contains house number otherwise provide error message | |
add_action( 'woocommerce_after_checkout_validation', 'validate_checkout', 10, 2); | |
function validate_checkout( $data, $errors ){ | |
if ( ! preg_match('/[0-9]/', $data[ 'billing_address_1' ] ) ){ | |
$errors->add( 'address', 'Het adresveld bevat geen huisnummer of busnummer.' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment