    function woocommerce_edit_my_account_page() {
        return apply_filters( 'woocommerce_forms_field', array(
            'woocommerce_my_account_page' => array(
                'type'        => 'text',
                'label'       => __( 'Kundennummer' ),
                'placeholder' => __( '' ),
                'required'    => true,
				'maxlength'   => "5",
            ),
        ) );
    }
    function edit_my_account_page_woocommerce() {
        $fields = woocommerce_edit_my_account_page();
        foreach ( $fields as $key => $field_args ) {
            woocommerce_form_field( $key, $field_args );
        }
    }
    add_action( 'woocommerce_register_form', 'edit_my_account_page_woocommerce', 15 );


function woocom_validate_extra_register_fields( $username, $email, $validation_errors )

{

if (isset($_POST['Kundennummer']) && empty($_POST['Kundennummer']) ) {

$validation_errors->add('Kundennummer_error', __('Die Kundennummer ist erforderlich!', 'woocommerce'));

}

if(strlen($_POST['Kundennummer']) <5 ) {
$validation_errors->add('Kundennummer_error', __('Die Kundennummer muss aus 5 Zahlen bestehen', 'woocommerce'));
}

if(!is_numeric($_POST['Kundennummer']) ) {
$validation_errors->add('Kundennummer_error', __('Die Kundennummer muss eine Zahl sein', 'woocommerce'));
}

return $validation_errors;

}

add_action('woocommerce_register_post', 'woocom_validate_extra_register_fields', 10, 3);