• Resolved moonfolk

    (@moonfolk)


    On my Woocommerce account registration fage, I have inserted a “custom function” to have “Confirm Password” field (refer: https://stackoverflow.com/questions/37521965/how-to-add-confirm-password-field-in-woocommerce-registration-page)

    /**
     * Add the code below to your theme's functions.php file
     * to add a confirm password field on the register form under My Accounts.
     */ 
    function woocommerce_registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
    	global $woocommerce;
    	extract( $_POST );
    	if ( strcmp( $password, $password2 ) !== 0 ) {
    		return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
    	}
    	return $reg_errors;
    }
    add_filter('woocommerce_registration_errors', 'woocommerce_registration_errors_validation', 10, 3);
    
    function woocommerce_register_form_password_repeat() {
    	?>
    	<p class="form-row form-row-wide">
    		<label for="reg_password2"><?php _e( 'Confirm password', 'woocommerce' ); ?> <span class="required">*</span></label>
    		<input type="password" class="input-text" name="password2" id="reg_password2" value="<?php if ( ! empty( $_POST['password2'] ) ) echo esc_attr( $_POST['password2'] ); ?>" />
    	</p>
    	<?php
    }
    add_action( 'woocommerce_register_form', 'woocommerce_register_form_password_repeat' );

    After activating B2BKing Premium, it adds B2B Registration Fields to the registration form, but before the “Confirm Password” field (refer screenshot: https://imgur.com/a/8vSdQzF

    Question:
    1) How can I have the B2B Registration Fields to come after the “Confirm Password” AND before the reCAPTCHA by adding custom code to functions.php and not by changing the plugin files?

    2) Or how can I edit the “custom function” above to make it come before the B2B Registration Fields?

    I’m not really good with writing codes, would appreciate it a lot to get help

    • This topic was modified 2 years, 1 month ago by moonfolk.
    • This topic was modified 2 years, 1 month ago by moonfolk.
    • This topic was modified 2 years, 1 month ago by moonfolk.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter moonfolk

    (@moonfolk)

    Found the solution myself! That was easy once I noticed it ?? Thanks and great plugin

    Plugin Author WebWizards

    (@webwizardsdev)

    Hi there,

    Thank you for using the plugin – I was just about to reply when I see you already solved.

    But just in case you have other similar issues: normally you can modify that code snippet to change the priority of the function.

    You have there: add_action( ‘woocommerce_register_form’, ‘woocommerce_register_form_password_repeat’ );

    It can be replaced with add_action( ‘woocommerce_register_form’, ‘woocommerce_register_form_password_repeat’, 10000 );

    I am not sure if 10000 will work as a priority, you can try different numbers like 1, 10, 10000 – but I think it will work by changing that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to adjust placement of entire B2B Registration Form’ is closed to new replies.