• I just found this which puzzles me. In the function woocommerce_process_registration() in the file woocommerce-functions.php I see this section when I register a new customer:

    // More error checking
    		$reg_errors = new WP_Error();
    		do_action( 'register_post', $sanitized_user_login, $user_email, $reg_errors );
    		$reg_errors = apply_filters( 'registration_errors', $reg_errors, $sanitized_user_login, $user_email );
    
    		if ( $reg_errors->get_error_code() ) {
    			$woocommerce->add_error( $reg_errors->get_error_message() );
    			return;
    		}

    This looks good so far. But when I compare it to the method process_checkout() in /classes/class-wc-checkout.php I find this:

    $reg_errors = new WP_Error();
    
    					do_action( 'woocommerce_register_post', $this->posted['account_username'], $this->posted['billing_email'], $reg_errors );
    
    					$errors = apply_filters( 'woocommerce_registration_errors', $reg_errors, $this->posted['account_username'], $this->posted['billing_email'] );
    
    	                // if there are no errors, let's create the user account
    					if ( ! $reg_errors->get_error_code() ) {

    So it looks like the checkout method is using the filter hook ‘woocommerce_registration_errors’ while the regular user registration is using ‘registration_errors’.

    But what’s even more puzzling is, that the checkout method is assigning the results from the filter to variable $errors but then checking variable $reg_errors.

    Is this a bug or am I not getting this right?

    http://wordpress.org/plugins/woocommerce/

  • The topic ‘woocommerce_registration_errors differs in registration and checkout’ is closed to new replies.