Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #179100
    Alvinarichard
    Participant

    I am having an unknown error while adding a custom registration form.Can you help me to fix t as I have already done what I can do with the code and now I am totally stuck what to do

    function wooc_validate_extra_register_fields( $username, $email, $validation_errors ) {
          if ( isset( $_POST['billing_first_name'] ) && empty( $_POST['billing_first_name'] ) ) {
                 $validation_errors->add( 'billing_first_name_error', __( '<strong>Error</strong>: First name is required!', 'woocommerce' ) );
          }
          if ( isset( $_POST['billing_last_name'] ) && empty( $_POST['billing_last_name'] ) ) {
                 $validation_errors->add( 'billing_last_name_error', __( '<strong>Error</strong>: Last name is required!.', 'woocommerce' ) );
          }
             return $validation_errors;
    }
    add_action( 'woocommerce_register_post', 'wooc_validate_extra_register_fields', 10, 3 );

    I have seen the code here https://www.cloudways.com/blog/add-woocommerce-registration-form-fields/

    #179103
    Skandha
    Participant

    @alvinarichard: Hello there,
    Please post your site URL so that I can look into the issue.

    Kind Regards,
    Skandha

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Error adding registration form’ is closed to new replies.