title: WooCommerce - Email and Post/Zip code validation
body: <p>I was wondering if anyone could point me in the direction of how exactly WooCommerce validates emails, and also how they validate post and zipcodes.</p>
  <p>I'm currently using the following code to display in-line messages for any required fields that haven't been filled:</p>
  <pre><code>function  CheckoutFieldsInlineError( $field, $key, $args, $value ) {
    if ( strpos( $field, '&lt;/label&gt;') !== false &amp;&amp; $args['required'] ) {
      $error = '&lt;span class=&quot;error&quot; style=&quot;display:none&quot;&gt;';
      $error .= sprintf( __('%s is a required field.','woocommerce' ), $args['label'] );
      $error .= '&lt;/span&gt;';
      $field = substr_replace( $field, $error, strpos( $field,'&lt;/p&gt;'),0);
    }
  return $field;
  }
  add_filter('woocommerce_form_field','CheckoutFieldsInlineError',99,4);
  </code></pre>
  <p>however, if the email address HAS been filled, but it's filled with something like &quot;as@a.&quot;, the form-row wrapper still has the valid woocommerce class, 'woocommerce-validated', see screenshot:</p>
  <p><a href="https://i.stack.imgur.com/mBf2N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mBf2N.png" alt="Attached screenshot showing valid woocommerce class even though the field is actually invalid." /></a></p>
  <p>Likewise, there seems to be a similar sort of validation going on for postcodes and zipcodes, I'm not sure if these run on a per country basis, or only for the UK and US, but it would be good to get clarification on how they work, and also, if there's anyway we can hook into these using a function, so we can display the error messages inline with the fields.</p>
  <p>If anyone can point me in the right direction, I'd be very grateful!</p>