Preview:
add_action('woocommerce_checkout_process', 'custom_validation_process');
 
function custom_validation_process() 
{
    global $woocommerce;
 
	if(isset($_POST['billing_address_1']) and $_POST['billing_address_1'] != '')
	{
		if (!preg_match('/([0-9]+)/Uis', $_POST['billing_address_1']))
		{
			if(function_exists('wc_add_notice'))
				wc_add_notice( __('Oops, vergeet niet je huisnummer in te vullen in het adresveld.'), 'error' );
			else
				$woocommerce->add_error( __('Oops, vergeet niet je huisnummer in te vullen in het adresveld.') );
		}
	}
   
    if(isset($_POST['ship_to_different_address']))
    {
        if(isset($_POST['shipping_address_1']) and $_POST['shipping_address_1'] != '')
		{
			if (!preg_match('/([0-9]+)/Uis', $_POST['shipping_address_1']))
			{
				if(function_exists('wc_add_notice'))
					wc_add_notice( __('Oops, vergeet niet je huisnummer in te vullen in het adresveld.'), 'error' );
				else
					$woocommerce->add_error( __('Oops, vergeet niet je huisnummer in te vullen in het adresveld.') );
			}
		}
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter