in theory it should work like that (untested!):

[cc lang=”php” escaped=”true” width=”600″]
/**
* Validate the extra register fields.
*
* @param string $username Current username.
* @param string $email Current email.
* @param object $validation_errors WP_Error object.
*
* @return void
*/
function wooc_validate_extra_register_fields( $username, $email, $validation_errors ) {

if ( isset( $_POST[‘first_name’] ) && empty( $_POST[‘first_name’] ) ) {
$validation_errors->add( ‘first_name_error’, __( ‘Error: First Name is required!.’, ‘woocommerce’ ) );
}

if ( isset( $_POST[‘last_name’] ) && empty( $_POST[‘last_name’] ) ) {
$validation_errors->add( ‘last_name_error’, __( ‘Error: Last Name is required!.’, ‘woocommerce’ ) );
}
}

add_action( ‘woocommerce_register_post’, ‘wooc_validate_extra_register_fields’, 10, 3 );

[/cc]
http://stackoverflow.com/questions/24245283/woocommerce-registration-form-validation-not-working

usually if there is an error in the form something like this is displayed:

[cc lang=”html” escaped=”true” width=”600″]

  • Fehler: Error: Anrede is required!

[/cc]

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin