Business Bloomer
  • About
  • WooCommerce Blog
  • Online Courses
  • Login
  • 0
  • About
  • WooCommerce Blog
  • Online Courses
  • Login
  • 0

WooCommerce: Separate Login, Registration, My Account Pages

> Published: Feb 2019 - Revised: Mar 2023
> Blog Category: WooCommerce Tips
> Blog Tags: Customer Login, Customer Registration, My Account
> Blog Comments: 189 Comments
Tweet

Join 17,000+ WooWeekly subscribers

There are times when you need to send logged out customers to a Login page and unregistered customers to a standalone Register page.

As you know, the WooCommerce My Account page, which contains the [woocommerce_my_account] shortcode, has both Login and Registration forms when registration is enabled on the My Account settings.

This is not always a good idea, mostly when you use landing pages or sales pages with a specific goal e.g. user registration.

Clearly, when this happens, you don’t want to have a login form there as well. My solution provides two new shortcodes, one for the login form and one for the register form, as well as a complete guide to set the whole process up. Enjoy!

Here are new shortcodes to display WooCommerce Login and Registration forms separately on custom pages!

Important Notes

As you know, the [woocommerce_my_account] shortcode is a very important one and must be kept on the WooCommerce My Account page at all costs. This means, you can’t get rid of it or delete the My Account page either.

If you want to have separate LOGIN, REGISTRATION and MY ACCOUNT pages then use this stack:

  1. Use [wc_reg_form_bbloomer] shortcode on the Register Page once SNIPPET #1 BELOW is active
  2. Use [wc_login_form_bbloomer] shortcode on the Login Page once SNIPPET #2 BELOW is active
  3. Keep [woocommerce_my_account ] shortcode on the My Account Page
  4. Add an optional registration redirection, so that customers go to the My Account page upon registration (login form already does that out of the box, the way I coded it)
  5. Add an optional logged in redirection – SEE SNIPPET #3 BELOW – if you don’t want to show the error message in case the customer accesses the Login or Registration pages while logged in, and redirect to the My Account page instead
  6. Enable “Allow customers to create an account on the “My account” page” on the “Accounts & Privacy” settings:
Please enable registrations from the “My Account” page

PHP Snippet #1: WooCommerce Customer Registration Shortcode

Place this shortcode [wc_reg_form_bbloomer] in a brand new WordPress page and the register form will magically appear. If the user is logged in, it will show a message instead.

/**
 * @snippet       WooCommerce User Registration Shortcode
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
  
add_shortcode( 'wc_reg_form_bbloomer', 'bbloomer_separate_registration_form' );
    
function bbloomer_separate_registration_form() {
	if ( is_user_logged_in() ) return '<p>You are already registered</p>';
	ob_start();
	do_action( 'woocommerce_before_customer_login_form' );
	$html = wc_get_template_html( 'myaccount/form-login.php' );
	$dom = new DOMDocument();
   $dom->encoding = 'utf-8';
	$dom->loadHTML( utf8_decode( $html ) );
	$xpath = new DOMXPath( $dom );
	$form = $xpath->query( '//form[contains(@class,"register")]' );
	$form = $form->item( 0 );
	echo $dom->saveXML( $form );
	return ob_get_clean();
}

PHP Snippet #2: WooCommerce Customer Login Shortcode

Please add this shortcode [wc_login_form_bbloomer] to a brand new Login page. If the user is logged in, it will show a message instead.

/**
 * @snippet       WooCommerce User Login Shortcode
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_shortcode( 'wc_login_form_bbloomer', 'bbloomer_separate_login_form' );
 
function bbloomer_separate_login_form() {
	if ( is_user_logged_in() ) return '<p>You are already logged in</p>'; 
	ob_start();
   do_action( 'woocommerce_before_customer_login_form' );
	woocommerce_login_form( array( 'redirect' => wc_get_page_permalink( 'myaccount' ) ) );
	return ob_get_clean();
}

PHP Snippet #3: Optionally Redirect Login & Registration Pages to My Account Page If Customer Is Logged In

/**
 * @snippet       Redirect Login/Registration to My Account
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'template_redirect', 'bbloomer_redirect_login_registration_if_logged_in' );

function bbloomer_redirect_login_registration_if_logged_in() {
    if ( is_page() && is_user_logged_in() && ( has_shortcode( get_the_content(), 'wc_login_form_bbloomer' ) || has_shortcode( get_the_content(), 'wc_reg_form_bbloomer' ) ) ) {
        wp_safe_redirect( wc_get_page_permalink( 'myaccount' ) );
        exit;
    }
}

Related posts:

  1. WooCommerce: Change User Role for New Customers
  2. WooCommerce: Deny Automatic Login Upon Registration @ My Account
  3. WooCommerce: File Upload @ My Account Registration Form
  4. WooCommerce: Login Redirect by User Role @ My Account
  5. WooCommerce: Login Redirect to Previous URL @ My Account
  6. WooCommerce: Custom Login Redirect @ My Account
  7. WooCommerce: Custom Registration Redirect @ My Account
  8. WooCommerce: Add Content @ My Account Register / Login Page
  9. WooCommerce: Horizontal My Account Navigation Menu
  10. WooCommerce: Rename “Completed” Order Status

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

Follow @rmelogli
Category: WooCommerce Tips
Tags: Customer Login, Customer Registration, My Account

Post navigation

Previous post: WooCommerce: Remove Jetpack Ads @ WP Dashboard
Next post: WooCommerce: Remove “Metaboxes” @ Product Edit Admin Page

189 thoughts on “WooCommerce: Separate Login, Registration, My Account Pages”

  1. Samir
    March 22, 2023

    Hi, everything works like a charm.

    However, after logging out, it redirects the user to the original WooCommerce My Account page.

    Wondering if you could help creating a code to redirect users to another url?

    Many thanks!

    Reply
    1. Rodolfo Melogli
      March 23, 2023

      Ok, I’ll post a tutorial next week!

      Reply
  2. Daniel
    March 20, 2023

    Hey, I have added the snippets to my woocommerce store and they are working fine. There is one problem though, the ‘register’ page won’t show any special characters, like ç and á, which are como in my language (Portuguese), replacing them by symbols like ç and á. Please, does anyone know to fix this? I found out that it may be related to the use of the saveXML( ) and that it have some character encoding problems, but I can’t figure out how to fix the issue. I tried to post in here before, but my post never showed up in the page. Thank you all for your help. Best

    Reply
    1. Rodolfo Melogli
      March 20, 2023

      I see. Do you have a screenshot for me?

      Reply
      1. Rodolfo Melogli
        March 20, 2023

        In the meanwhile, try this new version (I added UTF8 encoding)

        Reply
        1. Daniel
          March 20, 2023

          Hey Rodolfo, thank you very much for your answer. Your suggestion solved the problem completely.
          Great code! Thank you again! Best

          Reply
          1. Rodolfo Melogli
            March 23, 2023

            Excellent!

            Reply
        2. Tomas Rachmančiukas
          March 21, 2023

          Same problem here with encoding aswell

          Reply
          1. Rodolfo Melogli
            March 23, 2023

            Did you try the revised version?

            Reply
  3. Daniel
    March 17, 2023

    Hey, I’ve just added these codes to my page and they work fine. There is only one problem: snippet code 1 does not take in consideration the character encoding, and every special character in other languages, like ç and á in the registration page’s text becomes all messy… Is there a quick fix for that? Thank you very much for the codes and for any insights on this issue.

    Reply
  4. Venus
    February 7, 2023

    Hi

    I followed your instructions and the login page works but for the registration page nothing happens when I choose to register me as a vendor (no extend sections like the default [woocommerce_my_account] appears and nothing happens when I press the register button. I wasn’t redirect to any pages, not even any error page).

    Thanks!

    Reply
    1. Rodolfo Melogli
      February 28, 2023

      This tutorial is for a default WooCommerce install – making it compatible with a third party multi-vendor plugin may require additional code.

      Reply
  5. KJCheon
    January 7, 2023

    Hi, I use the shortcode [wc_reg_form_bbloomer] for the user registration form. And it works fine when registering as a normal member . But registering as a vondor, mercado multivendor plugin, error message “First name is required!”. The registration form fields are the same. Would you kindly guide me why and how I can fix this vendor registeration error?

    Reply
    1. Rodolfo Melogli
      January 13, 2023

      KJ, thanks so much for your comment! Unfortunately this looks like custom troubleshooting work and I cannot help here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

      Reply
  6. Pavan
    December 9, 2022

    Hi,

    PHP Snippet #2: Separate WooCommerce Login Form Shortcode:

    Login form does not show the error when logging in with wrong details.

    Please let me know how to make the error to appear.

    Thanks

    Reply
    1. Rodolfo Melogli
      December 16, 2022

      Ok thank you. I’ve revised the snippet, let me know

      Reply
  7. surya
    November 12, 2022

    i am not getting error messages on login page..i have used the code mentioned in comments but not working for me..

    everything is working fine except error messages not showing on login page..

    Reply
    1. Rodolfo Melogli
      November 30, 2022

      Works for me https://www.screencast.com/t/6pEZomuTUur – please check again and do the usual troubleshooting steps

      Reply
      1. Pavan
        December 9, 2022

        @surya mentioned it was for ‘Login’ page, not for ‘Register’ page.

        Reply
        1. Rodolfo Melogli
          December 16, 2022

          Ok thank you. I’ve revised the snippet, let me know if it works

          Reply
  8. Alex
    November 1, 2022

    Hi,
    thanks for your help but i have a problem.
    Unfortunately, if the user accidentally enters the registration page to log in (so he already has an account) with your code, this woocommerce error message does not appear: “Error: An account with this email address has already been registered. Log in “.

    Reply
    1. Rodolfo Melogli
      November 30, 2022

      Works for me https://www.screencast.com/t/6pEZomuTUur – please check again and do the usual troubleshooting steps

      Reply
  9. Mohammad Kashif
    May 9, 2022

    Can i only separate My Account Page?
    Like Login and Registration have same shortcode and My Account Page different shortcode.

    Thanks

    Reply
    1. Rodolfo Melogli
      May 15, 2022

      Hi Mohammad, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
      1. Mohammad Kashif
        May 26, 2022

        Submitted!

        Reply
  10. Oumaima
    April 23, 2022

    I used code snippets plugin to add the two snippets and then I added two pages login and register in which I put the shortcodes but nothing is showing up, can you help me find out what is the problem and how to fixe it

    Reply
    1. Rodolfo Melogli
      May 1, 2022

      Hello Oumaima! Can I ask you to disable all plugins but Woo & Code Snippets, and also to temporarily switch theme, and see if everything works ok?

      Reply
  11. Praveen
    March 9, 2022

    Hey the code works but the alignment of some fields are off, like all the names of fields are in line but the boxes are based on how long the label is and are not lining up so it doesn’t look good. Is there an easy fix to this? Thank you

    Reply
    1. Rodolfo Melogli
      March 25, 2022

      Hey Praveen, yes there is an easy fix, but you’ll need custom CSS for this, as it depends on your theme

      Reply
  12. Dip
    February 18, 2022

    Hi there, thanks for the code! Just one issue, after clicking register the page reloads and the email field stays, entering the same data in for the 2nd time then only registers

    Reply
    1. Rodolfo Melogli
      March 6, 2022

      Try to exclude that page from server- and WP-side cache

      Reply
  13. Damian
    January 19, 2022

    A checkbox for accepting the regulations in both places could be useful. My account and for a separate registration page.

    Reply
    1. Rodolfo Melogli
      February 14, 2022

      Yep, good idea

      Reply
  14. WishfulThinking
    December 20, 2021

    These snippets are working in a PHP 8 environment but styling is crude and I don’t know how to fix that.

    I noticed that the fields on the registration form are the same as on the combined page so …?

    I need the complete details because of the nature of my business for EULA of digital downloads.

    Thank you and best wishes.

    Reply
    1. Rodolfo Melogli
      January 8, 2022

      Screenshot please?

      Reply
  15. Emmanuel
    November 7, 2021

    This line

     woocommerce_login_form( array( 'redirect' => 'https://custom.url' ) );

    redirects every user role including admin to my-account page. How do i exclude admin from the redirect so admins will follow the standard redirect to dashboard?

    Reply
    1. Rodolfo Melogli
      November 8, 2021

      Hey Emmanuel thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
      1. Ryan
        January 4, 2022

        It’s pretty easy:

        if ( current_user_can('administration') ) {
          woocommerce_login_form( array( 'redirect' => 'https://custom.url/wp-admin/' ) );
        } else {
          woocommerce_login_form( array( 'redirect' => 'https://custom.url' ) );
        }
        

        Hope that helps!

        Reply
        1. Rodolfo Melogli
          January 8, 2022

          Cool

          Reply
          1. Daniela
            February 7, 2022

            Hello!, where do I have to paste this code?, I get an error in the functions.php

            woocommerce_login_form( array( ‘redirect’ => ‘https://custom.url’ ) );

            Thanks!

            Reply
            1. Rodolfo Melogli
              March 5, 2022

              Hi Daniela, that line pf PHP belongs to snippet #2. Did you paste the whole snippet #2 in functions.php? That line alone will give you an error indeed

              Reply
  16. Sohom Das
    October 31, 2021

    WoW Rodolfo,

    Your codes works awesome for me, I have a little customisation in my mind please let me know if it is possible.

    What I am lookin for a “button” on Login page as “Register” or “Not Register Yet” something like that below the login button, so that I can redirect Customers to Registration page from login page.

    Please reply if it is possible.
    Thanks in advance.

    Reply
    1. Rodolfo Melogli
      November 8, 2021

      Hey Sohom thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  17. Matthew
    October 18, 2021

    How can I get reCaptcha for WooCommerce to work with this registration form. Currently, it works on all other Woo forms including login, but it only displays the “Recaptcha” title on the registration form.

    Reply
    1. Rodolfo Melogli
      October 27, 2021

      Hi Matthew thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  18. Gabor Lippert
    October 13, 2021

    Thanks, guys, but this doesn’t work anymore in 2021.

    Or maybe because I use WordFence with WooCommerce and Google ReCaptcha V3 integration – but the registration shortcode doesn’t work.

    Symptoms: after submitting the custom registration form, nothing happens. No login, no error message, just a page refresh, and nothing else. ¯\_(ツ)_/¯

    Reply
    1. Rodolfo Melogli
      October 27, 2021

      If you disable those plugins, does it work?

      Reply
      1. Sohom Das
        October 31, 2021

        It worked for me I am using wordfence too. But no idea if it’s not working for recaptcha or not.

        Reply
  19. Joeri
    October 11, 2021

    Hi,

    I am using the Separate WooCommerce Login (Shortcode) snippet but the first time somebody is trying to login, the page just refreshes. The second time the login form works fine and you can login successfully. Any idea on what might cause this? Maybe a cache issue but it happens every time so I think that’s weird.

    Reply
    1. Rodolfo Melogli
      October 12, 2021

      If you temporarily disable server-side cache and cache plugins, does it work?

      Reply
  20. NK
    September 6, 2021

    Thanks for this.

    I was having problems styling the form as it didn’t pick up the theme or woocommerce styles.

    Enclosing the form within div class woocommerce helped

    Reply
    1. Rodolfo Melogli
      September 15, 2021

      Nice

      Reply
  21. Akash
    May 15, 2021

    Hello

    I was trying to use the code, but why in this code email address and password not align to each other..

    Please guide how to atleast align them properly.

    Reply
    1. Rodolfo Melogli
      June 2, 2021

      Hi Akash, this is default WooCommerce. If they align properly in the My Account page and they don’t here, it means you have a custom theme or custom CSS that is changing the default behavior, so you need to add some custom CSS as well

      Reply
  22. Omar Lopez
    March 23, 2021

    Hi, In a Separate WooCommerce Customer Registration page if the user is already loged in the form isn´t show anymore, is there a way that if the user is already login show another content instead of the register form??

    Reply
    1. Rodolfo Melogli
      April 19, 2021

      Hi Omar, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  23. Marco
    March 20, 2021

    Hello, is it compatibile with the plugin “Custom User Registration Fields for WooCommerce”?

    Reply
    1. Marco
      March 20, 2021

      And how can I add a “don’t have a account?” link on the login page?
      Thank you.

      Reply
      1. Rodolfo Melogli
        March 22, 2021

        Hi Marco, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

        Reply
    2. Rodolfo Melogli
      March 22, 2021

      No idea 😀

      Reply
  24. Tim
    February 26, 2021

    Thank you for the nice code!
    I am using Astra theme and everything works for me except that the width of fields and line breaks are not working as usual.

    Please check this image to see how it normally should look like:
    https://i.postimg.cc/wjPH7KYw/normal-form.jpg

    And this is how the forms look with shortcodes:
    https://i.postimg.cc/KYMbT9Zx/problem-form.jpg

    Would be very thankful if you could advice whats causing these issues and how to solve them.

    Best regards,
    Tim

    Reply
    1. Rodolfo Melogli
      March 24, 2021

      Hi Tim, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  25. Roland
    February 5, 2021

    Hi i treid to copy the snippet in the php area from oxygen, but it doesnt react…..am i doing something wrong?

    Reply
    1. Rodolfo Melogli
      February 18, 2021

      Not sure about Oxygen sorry

      Reply
      1. Daren
        February 19, 2021

        Use code snippets. I just did it on an oxygen site and it’s working fine.

        Reply
      2. Jeffrey
        March 10, 2021

        Hi,

        Temporary remove or comment the following code:

        if ( is_admin() ) return;
        if ( is_user_logged_in() ) return;

        If you try to open with Oxygen it is telling it’s logged in, so it will return nothing.

        Reply
  26. Ralf Longwitz
    December 18, 2020

    Hi Rodolfo,
    Do you know of a simple way to make the password visible while typing? I.e. the usual switch button, mostly an eye icon.
    Had a client today claiming login doesn’t work … just mistyped password. Happens to myself often.
    Thanks!

    Reply
    1. Rodolfo Melogli
      December 21, 2020

      Hi Ralf, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  27. iammammdal
    October 8, 2020

    thank you Rodolfo
    how can I add a checkbox for accepting the terms and make it required? Actually I have the code and it works properly, but I don’t know where to place it in this snippet.
    I also need a link to Registration Page on Login Page. I used the snippet #1 only

    Reply
    1. Rodolfo Melogli
      October 16, 2020

      Hi, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  28. Oscar
    August 31, 2020

    Hi all,

    Hope you are fine, I’ve a little issue, I’m using this snippet but the notice is not showing on the good place.

    For exemple if the password is not correct, the notice is shown on Registration page not on the login page. It is possible to solve this issue?

    Reply
    1. Rodolfo Melogli
      September 10, 2020

      Hi Oscar, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
      1. Ethan
        September 21, 2020

        Hi how do you set up the register to redirect to login page?

        Reply
        1. Rodolfo Melogli
          September 21, 2020

          Hi Ethan, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

          Reply
  29. Jatinder Kaur
    July 28, 2020

    Thanks a lot !!!!

    Reply
    1. Rodolfo Melogli
      July 28, 2020

      You’re welcome!

      Reply
  30. Shyam
    July 3, 2020

    I would like to remove the strong password criteria for user registration and setup the password condition like: any characters(letters/digits) with minimum of 6 and maximum of 16 character. Can you provide the sample code for this.

    Reply
    1. Rodolfo Melogli
      July 7, 2020

      Can’t, sorry

      Reply
  31. Seynal Kim
    June 30, 2020

    For some reason, the registration form won’t submit when using Dokan plugin, something’s missing, I think its Javascript or JQuery. I tried, using the shortcode

    woocommerce_my_account

    , and everything works but it cannot be used to create a separate login/registration page because it will show the account dashboard when the user is currently logged in.

    Anyway, when clicking the submit button on the registration form, the console gives me the following error.

    An invalid form control with name='fname' is not focusable.
    An invalid form control with name='lname' is not focusable.
    An invalid form control with name='shopname' is not focusable.
    An invalid form control with name='shopurl' is not focusable.
    An invalid form control with name='phone' is not focusable.
    

    The registration form works if the Dokan Plugin is not active, but I need it for a multi-vendor. Asking the issue to the Dokan support is a waste of time, 62 hours until now no response from them.

    Can you help me with this?

    Reply
    1. Rodolfo Melogli
      July 7, 2020

      Hi Seynal, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
      1. Seynal Kim
        July 15, 2020

        Nevermind, there’s a missing hook.

        remove_action( 'woocommerce_register_form', 'dokan_seller_reg_form_fields' );

        When using the Dokan plugin, the registration form will be altered or override by Dokan to add the custom field for Vendor Registration. The separate registration form won’t simply work because it is being blocked by the error and it is being handled by Dokan. By using the hook above, it removes the Dokan Custom Field for Vendor Registration.

        Reply
        1. Rodolfo Melogli
          July 20, 2020

          Nice

          Reply
  32. Mateus
    June 23, 2020

    Date: 06-22-2020
    Wc Version: 4.2.1

    Worked, Tks!!

    Reply
    1. Rodolfo Melogli
      June 28, 2020

      Awesome

      Reply
  33. alien
    May 21, 2020

    can you make it a plugin?

    Reply
    1. Rodolfo Melogli
      May 26, 2020

      No, sorry

      Reply
  34. Dhrovo
    April 26, 2020

    Hello, Rodolfo Melogli, thank you for this great post. i was suffering a lot to solve this issue and today i got it.

    Reply
    1. Rodolfo Melogli
      April 29, 2020

      Cool!

      Reply
  35. Amy Roseman
    April 25, 2020

    Hi! Thanks for help splitting these pages!

    The pages work, but the text and text boxes are out of alignment. I’m using a woocommerce compatible theme (Astra), so there shouldn’t be a conflict.

    How would you recommend I fix that?

    Thanks!

    Reply
    1. Rodolfo Melogli
      April 29, 2020

      Hello Amy, thanks so much for your comment! Yes, this is definitely possible with custom CSS, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  36. Carl Hales Davies
    April 17, 2020

    This worked fine for me

    What I found though and it looks like a few people in the comments had the same issue.

    It looks like a BLANK screen when you do it CORRECTLY

    But this is because you are already LOGGED in

    If you log out. You can see the form perfectly.

    Is there a way we can get it to re-direct to a certain URL?

    Or at least say thanks for registering or something?

    Thanks

    Reply
    1. Rodolfo Melogli
      April 20, 2020

      Hi Carl! If you referring to Snippet #2, I’ve added a “redirect” argument you could test in order to redirect logged in users to a custom URL. Let me know if that works!

      Reply
      1. John Boase
        May 1, 2020

        Great info and works a treat…thank you!

        What would I need to change the argument ‘woocommerce_login_form( array( ‘redirect’ => ‘https://custom.url’ ) );’ to in order for me to use it within #Snippet 1 on the registration page please and would you mind telling me if it should go directly under ‘ob_start();’ or directly above ‘return ob_get_clean();’.

        Keep up the great work!

        Regards

        John

        Reply
        1. Rodolfo Melogli
          May 13, 2020

          Sorry, can’t help

          Reply
      2. Miguel
        May 3, 2020

        Hi, I have the same problem in the case of Snippet #1.

        I put the snippet on a new “Regist” page, when user puts his email and press the button, the page is reloaded without the form.

        It is possible to redirect the user to another url?

        Thank you.

        Reply
        1. Miguel
          May 3, 2020

          I made this little change:

          this:

          if ( is_user_logged_in() ) return;

          for:

          if ( is_user_logged_in() ){ header( "Location: /mi-cuenta" ); die; }
          Reply
          1. Rodolfo Melogli
            May 13, 2020

            Ok

            Reply
            1. Dave
              September 30, 2020

              Miguel’s solution worked well. I have only amended it to redirect to the my-account page, so it looks as follows:

              if (is_user_logged_in() ){ header( “Location: /my-account” ); die; }

              Reply
              1. Rodolfo Melogli
                October 1, 2020

                Cool

                Reply
  37. Robert
    April 11, 2020

    Hello, thanks for this review! Sadly, it doesn’t work for me.
    I pasted the codes in my function.php and used this shortcode on my page: [wc_reg_form_bbloomer]. I also unchecked ‘allow customers to…’
    I’m using a Divi Child theme.

    Am I doing something wrong? Would be very happy if this works! I want a custom registration page and a custom login page.
    Would someone be so kind to help me?

    Stay save!

    Best regards,
    Robert
    (The Netherlands)

    Reply
    1. Rodolfo Melogli
      April 14, 2020

      Hi Rob, thanks for your comment! I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?

      To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme (load the snippet there in functions.php) – does it work? If yes, you have a problem with your current theme or one of the plugins.

      Hope this helps!

      R

      Reply
  38. Ahmed Elsayed
    April 10, 2020

    Hi Rodolfo,

    I did everything you said, but unfortunately it doesn’t show any thing on the register page.

    would you help me fix this?

    Thanks in advance.

    Reply
    1. Rodolfo Melogli
      April 14, 2020

      Ahmed, thanks so much for your comment! I’m afraid it’s custom work – if you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  39. Mark
    April 3, 2020

    I put this code in my child theme via FTP. When I put the shortcode on the login page, it only shows [wc_login_form_bbloomer] on the page (same for the registration page). I don’t know what I am doing wrong and I look forward to your reply.

    Reply
    1. Rodolfo Melogli
      April 9, 2020

      That means those shortcodes are not registered. Used the exact same code? Maybe you have errors in your functions.php?

      Reply
  40. Giorgiokatr
    March 28, 2020

    I would like to keep the default two tab login register . Can i use snipppet 1 to add this register shortcode to a different page? I would like on that different page to show the registration form only. But keep also the existing functionallity of WooCommerce in tbe default my account.

    Reply
    1. Rodolfo Melogli
      March 31, 2020

      Of course!

      Reply
  41. Amir Khan
    March 6, 2020

    how can use forgot password short code

    Reply
    1. Rodolfo Melogli
      March 9, 2020

      Hi Amir, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  42. Greg Salyer
    January 24, 2020

    This worked but does not put a box around the login and the user name and password fields are not the same length. How can I make it look like the one on [[woocommerce_my_account]]

    Reply
    1. Rodolfo Melogli
      January 25, 2020

      Hi Greg, you probably need to re-use some CSS classes or add your custom CSS. Either way this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  43. Aidan
    January 2, 2020

    This is fantastic work and is helping to solve a lot of the problems I have on the project I’m working on thanks a lot!

    There is one small problem though and I was hoping you could help with that since you seem pretty in the loop here. I’ve added a bunch of extra custom fields to registration for the site I’m on and added them, but now when I display them they come out first before Email. I only realized that was an entirely different issue half way through typing this, but hey, maybe you know how I can reorder my registration fields without a plugin? Seems to me, if you’re creating your own separate pages, then there is a fair chance you might have done this yourself, so heres hoping.

    Best,
    Aidan

    Reply
    1. Rodolfo Melogli
      January 6, 2020

      Hi Aidan, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  44. dev
    November 29, 2019

    There is no success message showing after successfull registration

    Reply
    1. Rodolfo Melogli
      December 2, 2019

      See previous comments & let me know

      Reply
  45. Tiago Oliveira
    November 25, 2019

    I posted the code on my theme’s function file and have a seperate register page nos, everything works fine, the only problem i have is that the register form design does not match my theme, how can i make it match the theme?

    Reply
    1. Rodolfo Melogli
      November 27, 2019

      You’ll need some CSS magic. Sorry but that’s custom to your theme/website

      Reply
  46. Peter
    November 15, 2019

    I’m wondering it would be safer and simpler if if I would hide login or registration form with js. I could add a button “Not yet a user? Register here.” and reveal reg form with js. Similarly a button after reg form (“I registered already. Login here.”) and reveal login form and hide reg form. This way the vanilla forms can stay. Thoughts?

    Reply
    1. Rodolfo Melogli
      November 19, 2019

      Sure, anything is possible!

      Reply
    2. Simmi Dhaliwal
      December 4, 2019

      Hi Peter! I love this idea and it’s exactly what I’m looking for. Is there any way you can share how you did this?

      Reply
      1. Sohom Das
        October 31, 2021

        I am looking for this solution, have you get the solution?

        Reply
  47. Shobhit Gupta
    November 5, 2019

    Hi,
    I tried it with my website and it is working perfectly. Thanks for sharing this info with us.

    Reply
    1. Rodolfo Melogli
      November 10, 2019

      Great!

      Reply
  48. Allan
    November 4, 2019

    where should i add the registration short-code

    Reply
    1. Rodolfo Melogli
      November 10, 2019

      Anywhere you like. Custom WP page maybe?

      Reply
  49. kaushik
    October 13, 2019

    Not work on my websites

    Reply
    1. Rodolfo Melogli
      October 22, 2019

      Works on mine, sorry 😐

      Reply
  50. James
    October 12, 2019

    The fields not adding in the registration form using a plugin. I am trying to add it manually. Is there any alternative to do this? It would be really helpful if you could help me to add fields in the registration form.

    Reply
    1. Rodolfo Melogli
      October 22, 2019

      James, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  51. Tomas
    September 18, 2019

    Hi, thanks for this!

    I used both snippets. after successfully registering, I then login via custom page with the [wc_login_form_bbloomer] short code.

    Right after it logs in successfully login the page which turns blank and not redirect me to /my-account/. Later manually going to /my-account/ does work though.

    TL;DR It’s not redirecting to /my-account/ after successful login-any ideas?

    Reply
    1. Rodolfo Melogli
      September 19, 2019

      Hi Tomas, you can pass a ‘redirect’ argument inside woocommerce_login_form() function, that should do the trick

      Reply
      1. doniphan
        January 16, 2020

        Could you show me where this would go in the snippet?

        Reply
        1. Rodolfo Melogli
          January 20, 2020

          No, sorry. But look at this, maybe it can help: https://docs.woocommerce.com/wc-apidocs/source-function-woocommerce_login_form.html#2090-2106

          Reply
  52. Julian
    September 17, 2019

    Hi, is the a way to add additional fields like Name and Last Name to the Snippet?

    Reply
    1. Rodolfo Melogli
      September 19, 2019

      https://businessbloomer.com/woocommerce-add-first-last-name-account-register-form/

      Reply
  53. Max Terbeck
    September 2, 2019

    Thanks for this code Rodolfo!
    I was having the problem that error messages were not displaying, I found that if you insert

    <?php do_action( 'woocommerce_before_customer_login_form' ); ?>

    before the form method solves the problem.

    Reply
    1. Rodolfo Melogli
      September 6, 2019

      Excellent!

      Reply
      1. Hamad
        December 9, 2022

        Where do you add this exactly on the separate login snippet? I can’t seem to figure where to add it .

        I am trying to get the error messages on my login for when they enter wrong info like password or email etc.

        Reply
        1. Rodolfo Melogli
          December 16, 2022

          Hi Hamad, check the latest version of the snippet and le tme know

          Reply
  54. mid
    August 30, 2019

    Question – I copy pasted both snippets into my child theme’s functions.php file, but the form doesn’t appear. The shortcode doesn’t appear either, it’s just a blank. Could you help me pls?

    Reply
    1. mid
      September 1, 2019

      Ok, so it’s working now 🙂 But the registration page button doesn’t work. Clicking it doesn’t do anything, it remains static

      Reply
      1. Rodolfo Melogli
        September 6, 2019

        It should work 🙂

        Reply
    2. Al
      October 2, 2019

      How did you get it working? It’s a blank content area for me, the shortcode also does not appear!?

      Reply
    3. Mochammad
      November 16, 2019

      Hey, I am stuck with this now, could you help me? I am curious how you can solve it. Thank you!

      Reply
  55. Jay Thornton
    August 6, 2019

    2 issues I’ve gotten.
    1. I’ve got TOS Agree enabled and it’s not part of your register form.
    2. No errors showing so users don’t know something is incorrect.

    Reply
    1. Rodolfo Melogli
      August 12, 2019

      Hi Jay!

      1. I’ve got TOS Agree enabled and it’s not part of your register form.

      Enabled in the Woo settings? Do they show on the standard My Account page?

      2. No errors showing so users don’t know something is incorrect.

      I just tested this again with Storefront theme on my homepage and errors show perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?

      To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme (load the snippet there in functions.php) – does it work? If yes, you have a problem with your current theme or one of the plugins. Hope this helps!

      Reply
  56. Chris
    July 26, 2019

    Hi,

    It doesn’t validate emails. So, if someone tries and email that is already in use it just stays the same and doesn’t give an error.

    Thanks,

    Reply
    1. chris
      July 26, 2019

      Is the above snippet 1 correct (see below)? Should #registra be something else “registration”?

      form method=”post” class=”woocommerce-form woocommerce-form-register register” action=”#registra”

      Reply
      1. Rodolfo Melogli
        August 1, 2019

        Try now, I’ve revised the 2 snippets 🙂

        Reply
  57. Shmulik
    July 26, 2019

    Another solution: create two pages with the shortcode [woocommerce_my_account]
    use css to hide login form on one page and hide the registration form on the second page.
    This way you can have the validation on the page.

    Shmulik

    Reply
    1. Rodolfo Melogli
      August 1, 2019

      Good idea as well, however hiding things with CSS is not great in regard to performance. And someone techy can always set that to display:block

      Reply
  58. Ofer
    July 16, 2019

    This is great!
    I have to say that your solutions are the best out there. I believe I owe you money LOL.
    I have only one suggestion for this snippet: wrap the with so any styling done with this class will apply too.

    Reply
    1. Rodolfo Melogli
      July 22, 2019

      Thank you Ofer!

      Reply
  59. marvin
    July 16, 2019

    The code is still working, only 1 problem I found, and i was wondering if you cooed help with this.
    Error code are not displayed. so you get no feedback, if you use the wrong password it tells you nothing (making users think its broken, when there password and or username is wrong)

    Ps: Sry dyslexic.

    Reply
    1. Demian
      July 23, 2019

      Woocommerce has this php snippet for the error messages, which is missing in the above snippet: . You put this before the .

      However, if you separate the login form and the register form, you can put these notices only once in your snippet, so I am not sure how to add this if you have 2 shortcodes for both forms, you cannot add it for both forms. Some tips or advice would be good.

      Reply
  60. دانلود رمان
    July 3, 2019

    i tried this but its not working i have errors of all kind here

    Reply
    1. Rodolfo Melogli
      July 8, 2019

      Screenshot please?

      Reply
  61. Yakub
    June 24, 2019

    thank you for this code. This code is very useful.
    How can i redirect it to a custom page after login/registration using this code.

    Reply
    1. Rodolfo Melogli
      July 6, 2019

      Hi Yakub, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  62. Enrico
    June 18, 2019

    Hi Rodolfo,
    I followed your guide to create a registration page separate from the login. Everything works except field validation!
    Even if I leave the fields empty, the form does not return an error.
    How can I solve it? Thank you

    Reply
    1. Rodolfo Melogli
      June 20, 2019

      Good point Enrico – if you already did the default troubleshooting (disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme), then there’s for sure a missing part in the snippet or we need to call the validation in some other way. If you find a solution let me know 🙂

      Reply
    2. Deborah
      June 20, 2019

      I have the same problem too. When I followed this guide and set up the custom registration form, the validation worked perfectly. I realized only yesterday that the validation fields had stopped working and I can’t find a solution to fix the problem. I think it depends on woocommerce updating, but I don’t know for sure.

      Does anyone have a suggestion on what to do?

      Reply
  63. Vanessa
    June 2, 2019

    I’m sorry but your “login” seperate page snippet #2 does not work. At all. The form doesn’t show up.

    Reply
    1. Rodolfo Melogli
      June 6, 2019

      Works for me 🙂 To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme (load the snippet there in functions.php) – does it work?

      Reply
  64. Roee
    April 30, 2019

    Hey there. I’ve just copied Snippet #1 to my child theme’s functions.php but something in the code brakes the site. I’ve tried to change line 23 to my child theme path I thought it might help but it didn’t.

    Any advice please?

    Reply
    1. Rodolfo Melogli
      May 8, 2019

      You’re right, thank you! Snippet 1 fixed 🙂

      Reply
  65. Drew
    April 26, 2019

    I’ve added a few snippets to my Child Theme’s functions.php file without any problems. And if there is a possible problem…the php editor I use will not allow the code to be registered.

    Well…copied the first snippet that creates the shortcode for the registration page and once I hit the ‘save’ button…my site was immediately broke!

    So, guess it’s time to remove the code and move onto a different solution.

    But seriously…why we even have to look for a workaround for something WooCommerce should provide the option for (separate login and registration pages) is kind of ridiculous!

    Drew
    Las Vegas, NV

    Reply
    1. Rodolfo Melogli
      May 8, 2019

      Hello Drew, what error did you get when your site got “broken”?

      Reply
      1. Rodolfo Melogli
        May 8, 2019

        Hold on, I found the bug. Snippet 1 fixed!

        Reply
  66. John
    April 21, 2019

    Hey Rodolfo, great work thank you. But I have a question, notifications are not showing up “wrong password, required fields, etc.” how can we implement those notifications on new registration page?

    Reply
    1. Rodolfo Melogli
      May 8, 2019

      Good question John! Try with https://stackoverflow.com/questions/46631939/display-woocommerce-notices-on-a-page

      Reply
  67. thomas
    April 11, 2019

    “woocommerce password strength” don’t work in “Separate WooCommerce Customer Registration” page.
    There is a solution to this problem?

    https://stackoverflow.com/questions/51674995/woocommerce-custom-registration-form-no-password-validation

    Thank’s

    Reply
    1. Rodolfo Melogli
      April 19, 2019

      Hello Thomas, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  68. kapadiyah
    March 18, 2019

    It’s not working, could you please help

    Reply
    1. Rodolfo Melogli
      March 28, 2019

      Hey Kapadiyah, what error are you getting?

      Reply
  69. Maged Mohamed
    March 11, 2019

    When i try to add the snippet both the first and the 2nd i got an error: https://prnt.sc/mw9qrf

    i tried to add it using functions.php and also tested with code snippet plugin but i got the same error .. why and what is that line ?

    Reply
    1. Rodolfo Melogli
      March 15, 2019

      I can see the error there… on line 23

      Reply
  70. Umair Arshad
    February 26, 2019

    code is very useful,
    thank you so much, but i need some more fields in registration form.
    i want first name, last name and retype password fields as well.
    kindly response me if you can.
    thanks again.

    Reply
    1. Rodolfo Melogli
      February 27, 2019

      Umair, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

      Reply
  71. romeo
    February 15, 2019

    Yes it is still working. Thank you=. But the problem I have is I want it to redirect to the home page after login in and also the login page shouldn’t show after users are logged in

    Reply
    1. Rodolfo Melogli
      February 27, 2019

      Thank you 🙂 Maybe try using the [[woocommerce_my_account]] shortcode instead of the login one. The other issue, that’s custom work sorry!

      Reply
    2. Marvin
      July 16, 2019

      Hi i also wanted people to be redirected to the home page after login / logout
      Here is the code i’m using:

      ———————————————————————————————————————————

      /*—————————————————————————-*/
      // redirects for login / logout
      /*—————————————————————————-*/
      add_filter(‘woocommerce_login_redirect’, ‘login_redirect’);

      function login_redirect($redirect_to) {

      return home_url();

      }

      add_action(‘wp_logout’,’logout_redirect’);

      function logout_redirect(){

      wp_redirect( home_url() );

      exit;

      }

      ——————-End-of-code-Do-Not-coppy-this-line——————–

      I hope this works for you 🙂

      Reply
      1. Rodolfo Melogli
        July 22, 2019

        Hi Marvin, thanks for your comment 🙂

        Yes I’m sure errors can be shown, but this is custom work and I can’t help via the blog comments I’m afraid.

        That code you shared is awesome, thanks for that!

        Reply
  72. Peter
    February 15, 2019

    Rodolfo, Thank you for writing this up for us! I will try it when I have time and check back on you. Keep up the great work.

    Reply
    1. Rodolfo Melogli
      February 27, 2019

      Nice 🙂

      Reply
  73. Nghĩa
    February 13, 2019

    thank

    Reply
    1. Rodolfo Melogli
      February 14, 2019

      You’re welcome!

      Reply
      1. tahir khan
        November 13, 2019

        error message not showing in registration shortcode like email address already exists.

        Reply
        1. Rodolfo Melogli
          November 14, 2019

          https://businessbloomer.com/woocommerce-separate-login-registration/#comment-264665

          Reply
Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts
  • WooCommerce: Redirect Product Category Pages
  • WooCommerce: Close Button @ WooCommerce Checkout Notices
  • WooCommerce: Related Products Custom Heading & Subheading
  • WooCommerce: Display Stock Status For External Products
  • WooCommerce: Display Product Grid @ Order Emails e.g. Related Products
About Business Bloomer

With 100,000 (and growing) monthly organic sessions, Business Bloomer is the most consistent, most active and most complete WooCommerce development/customization blog.

Of course this website itself uses the WooCommerce plugin, the Storefront theme and runs on a WooCommerce-friendly hosting.

Join 75,000+ Monthly Readers & 16,500+ Subscribers.

Become a Business Bloomer Supporter.

Join BloomerArmada and become an Official Business Bloomer Supporter:
easy-peasy, and lots of perks for you.
See your Benefits →
Popular Searches: Visual Hook Guides - Checkout Page - Cart Page - Single Product Page - Add to Cart - Emails - Shipping - Prices - Hosting
Latest Articles
  • WooCommerce: Redirect Product Category Pages
  • WooCommerce: Close Button @ WooCommerce Checkout Notices
  • WooCommerce: Related Products Custom Heading & Subheading
  • WooCommerce: Display Stock Status For External Products
  • WooCommerce: Display Product Grid @ Order Emails e.g. Related Products
Latest Comments
  • Rodolfo Melogli on The Ultimate Guide to WooCommerce Coupons
  • Rodolfo Melogli on Account Management & Privacy
  • Gary
    PRIORITY COMMENTER »
    on CustomizeWoo FREE
  • IAN
    PRIORITY COMMENTER »
    on Account Management & Privacy
Find Out More
  • Become a WooCommerce Expert
  • WooCommerce Blog
  • WooCommerce Online Courses
  • WooCommerce Weekly
  • Bloomer Armada
  • Affiliate Program
  • Contact
Contact Info

Ciao! I’m Rodolfo Melogli, an Italian Civil Engineer who has turned into an international WooCommerce expert. You can contact me here:

Email: [email protected]

Twitter: @rmelogli

Hire me by the hour: Get Quote »

VisaMastercardAmexPayPal Acceptance Mark
Business Bloomer © 2011-2023 - Terms of Use - Privacy Policy