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!

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:
- Use [wc_reg_form_bbloomer] shortcode on the Register Page once SNIPPET #1 BELOW is active
- Use [wc_login_form_bbloomer] shortcode on the Login Page once SNIPPET #2 BELOW is active
- Keep [woocommerce_my_account ] shortcode on the My Account Page
- 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)
- 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
- Enable “Allow customers to create an account on the “My account” page” on the “Accounts & Privacy” settings:

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 businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 9
* @community https://businessbloomer.com/club/
*/
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->saveHTML( $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 businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 9
* @community https://businessbloomer.com/club/
*/
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 businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 9
* @community https://businessbloomer.com/club/
*/
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;
}
}
PHP Snippet #1: Error
Warning: DOMDocument::loadHTML(): Tag wc-order-attribution-inputs invalid in Entity, line: 57 in /home/clients/a6f04aac48c5cfb7f448c84f298af395/sites/mysite.example/wp-content/plugins/insert-headers-and-footers/includes/class-wpcode-snippet-execute.php(419) : eval()’d code on line 18
Does this happen even if you place the code in a custom plugin or child theme instead of Code Snippets?
Hi Rodolfo,
I’ve been using Snippet #2 for the past year on a client’s site, to redirect members to a Members-Only page after login . It’s been working great.
However the redirect doesn’t seem to work after updating to WooCommerce 9.5 — users are redirected to the Home page. Did something change?
Could a caching issue be involved?
I don’t think so. Do you also use Snippet #3?
Hi Rodolfo,
This is amazing trick, and I would really appreciate that you share this.
The code works greatly well, however, when I activate the third code block, Elementor cannot open the page contains the shortcode. Could you please share any thought or comment to fix this?
I implemented debug process like deactivating plugins and stuff but nothing was really went out of the rail. If you could share your knowledge just a little bit, I would greatly appreciate it.
p.s. One of your reply on random question in this post like “sorry, works on mine.” is real good one. I literally laughed so hard
Hello there! Weird, did you change some of snippet #3 or did you use the exact same?
hey ! i did all the steps as the guide says:
1. i created a login page with the [wc_login_form_bbloomer] shortcode
2. i created a registration page with the [wc_reg_form_bbloomer] shordcode
3.i added the PHP Snippet: Redirect Registered Customers to Custom URL @ My Account Page.
finally added all the 3 snippers to function.php
but nothing is happens, when i press the account button – where are still 2 forms login and sign up.
am im doing something wrong?
will be happy to get advice. thanks ahead!
I guess the My Account page for logged out users needs to be hidden, and you need to send them to the Login or Registration page instead?
Hey! I’ve been using this code for some time and it always worked great.
For some reason now the register button wont appear anymore on the register page. I can see the input field (to write the email address), but the button itself is missing. I also notice that: 1) the button still appears normally on the default my-account page; and 2) i can still see the button in the register page’s source-code. What could be the reason for such behavior? Thanks a lot!
Sounds like a plugin conflict to me?
Hey,
I was able to track down the problem. It comes from the woo feature Order Attribution (Woocommerce > Settings > Advanced > Features). It adds tag inside registration, login and checkout forms. And it looks like the $dom->loadHTML not supported HTML5 elements. The exact error is “Warning: DOMDocument::loadHTML(): Tag wc-order-attribution-inputs invalid in Entity”.
So, if you turn off the Order Attribution feature everything work as usual.
Rodolfo, is there any workaround that will work with this feature, because it is really useful? Thank you!
Try with this fix: https://www.businessbloomer.com/woocommerce-separate-login-registration/#comment-1017086
Awesome. Came here just today top say this happened with the Woo updates past 8.7.1. So great to see the blog other, commenter, and community working together actively. This one had my head beating the wall today, that is for sure!
Great!
I seem to have an issue with the Customer Registration form in the latest version of WooCommerce (8.8.3). The register button isn’t displaying. It seems to appear for a split second as the page loads and then disappears. Rolling back to an older version of WooCommerce that I knew worked ok (8.6.1) seemed to fix it and the Register button reappeared.
Not sure, sorry!
it’s the same problem for me. using the latest WC 8.9.1 and the registration form is not displaying properly.
See https://www.businessbloomer.com/woocommerce-separate-login-registration/#comment-1017086 and let me know!
I found the solution with the help of AI, if you update the
then the form is displaying properly again.
Nice, thank you!
Hello, the code works perfectly fine for me, many thanks for your help, but if I try to place a reCAPTCHA or Cloudflare’s turnstile on the registration page, I encounter an issue.
The captcha/turnstile appears on the login page created for the code, for the original my-account page of WooCommerce (the message appears below the login section and the create an account section), but on the register account page created for the code, the captcha/turnstile does not appear at all.
Any idea on how to resolve this issue?
Hello Red, 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!
Hi, can i change or redirect the path to the lost-password-page on the login-page
That can be done with a redirect maybe?
Hi again,
For the password strength meter I was able to get it working by enqueing the javascript on this page
Not sure if there’s a cleaner, better way to do this.
Thanks again for these snippets.
Nice!
Hi again, Regarding the show/hide password icon, it looks like the form needs to be inside a div for the javascript to work:
I added this around my shortcode and now it’s displaying the icon.
Thank you!
Thanks alot for these codes. It has helped me reduced some plugins from my project
but I have a useful request to make
will it it possible to add redirect url to these shortcodes?
For EXAMPLE :
[wc_reg_form_bbloomer redirect=”page_url”] to direct user to that page after registration
or [wc_login_form_bbloomer redirect=”shop_url”] to direct users to shop page after login
this way, it will be possible to use different login and register forms for different purposes on a particular website
One of the snippets is exactly about that, please read the whole tutorial
Thank you! there is one issue that I detected, when user insert already registred email in the register form and he get the error message “Error: An account is already registered with your email address. Please log in.”
The link “Please log in” is not working and not redirect to the login page.
You’re right. The “please log in” link requires a JS listener to toggle the login form, which is not on the custom registration page, but can only be found on the default checkout. I’ll see what I can do about that
I”m also looking for a solution to this. The link stays on the same page as the page contains both login and register forms.
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!
Ok, I’ll post a tutorial next week!
Was there an updates on that?
Thanks!
https://www.businessbloomer.com/woocommerce-logout-redirect-my-account/
I tried the snippet inside the link you have shared. but it’s not working, after user log out it’s redirect to the regular my account page and shows login & register forms
Works perfectly for me. Where did you try to log out from?
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
I see. Do you have a screenshot for me?
In the meanwhile, try this new version (I added UTF8 encoding)
Hey Rodolfo, thank you very much for your answer. Your suggestion solved the problem completely.
Great code! Thank you again! Best
Excellent!
Same problem here with encoding aswell
Did you try the revised version?
This helped for me
Cool
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.
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!
This tutorial is for a default WooCommerce install – making it compatible with a third party multi-vendor plugin may require additional code.
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?
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
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
Ok thank you. I’ve revised the snippet, let me know
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..
Works for me https://www.screencast.com/t/6pEZomuTUur – please check again and do the usual troubleshooting steps
@surya mentioned it was for ‘Login’ page, not for ‘Register’ page.
Ok thank you. I’ve revised the snippet, let me know if it works
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 “.
Works for me https://www.screencast.com/t/6pEZomuTUur – please check again and do the usual troubleshooting steps
Can i only separate My Account Page?
Like Login and Registration have same shortcode and My Account Page different shortcode.
Thanks
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!
Submitted!
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
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?
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
Hey Praveen, yes there is an easy fix, but you’ll need custom CSS for this, as it depends on your theme
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
Try to exclude that page from server- and WP-side cache
A checkbox for accepting the regulations in both places could be useful. My account and for a separate registration page.
Yep, good idea
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.
Screenshot please?
This line
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?
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!
It’s pretty easy:
Hope that helps!
Cool
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!
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
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.
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!
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.
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!
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. ¯\_(ツ)_/¯
If you disable those plugins, does it work?
It worked for me I am using wordfence too. But no idea if it’s not working for recaptcha or not.
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.
If you temporarily disable server-side cache and cache plugins, does it work?
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
Nice
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.
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
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??
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!
Hello, is it compatibile with the plugin “Custom User Registration Fields for WooCommerce”?
And how can I add a “don’t have a account?” link on the login page?
Thank you.
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!
No idea 😀
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
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!
Hi i treid to copy the snippet in the php area from oxygen, but it doesnt react…..am i doing something wrong?
Not sure about Oxygen sorry
Use code snippets. I just did it on an oxygen site and it’s working fine.
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.
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!
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!
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
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!
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?
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!
Hi how do you set up the register to redirect to login page?
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!
Thanks a lot !!!!
You’re welcome!
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.
Can’t, sorry
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
, 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.
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?
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!
Nevermind, there’s a missing hook.
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.
Nice
Date: 06-22-2020
Wc Version: 4.2.1
Worked, Tks!!
Awesome
can you make it a plugin?
No, sorry
Hello, Rodolfo Melogli, thank you for this great post. i was suffering a lot to solve this issue and today i got it.
Cool!
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!
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!
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
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!
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
Sorry, can’t help
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.
I made this little change:
this:
for:
Ok
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; }
Cool
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)
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
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.
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!
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.
That means those shortcodes are not registered. Used the exact same code? Maybe you have errors in your functions.php?
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.
Of course!
how can use forgot password short code
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!
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]]
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!
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
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!
There is no success message showing after successfull registration
See previous comments & let me know
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?
You’ll need some CSS magic. Sorry but that’s custom to your theme/website
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?
Sure, anything is possible!
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?
I am looking for this solution, have you get the solution?
Hi,
I tried it with my website and it is working perfectly. Thanks for sharing this info with us.
Great!
where should i add the registration short-code
Anywhere you like. Custom WP page maybe?
Not work on my websites
Works on mine, sorry 😐
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.
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!
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?
Hi Tomas, you can pass a ‘redirect’ argument inside woocommerce_login_form() function, that should do the trick
Could you show me where this would go in the snippet?
No, sorry. But look at this, maybe it can help: https://docs.woocommerce.com/wc-apidocs/source-function-woocommerce_login_form.html#2090-2106
Hi, is the a way to add additional fields like Name and Last Name to the Snippet?
https://businessbloomer.com/woocommerce-add-first-last-name-account-register-form/
Thanks for this code Rodolfo!
I was having the problem that error messages were not displaying, I found that if you insert
before the form method solves the problem.
Excellent!
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.
Hi Hamad, check the latest version of the snippet and le tme know
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?
Ok, so it’s working now 🙂 But the registration page button doesn’t work. Clicking it doesn’t do anything, it remains static
It should work 🙂
How did you get it working? It’s a blank content area for me, the shortcode also does not appear!?
Hey, I am stuck with this now, could you help me? I am curious how you can solve it. Thank you!
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.
Hi Jay!
Enabled in the Woo settings? Do they show on the standard My Account page?
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!
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,
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”
Try now, I’ve revised the 2 snippets 🙂
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
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
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.
Thank you Ofer!
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.
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.
i tried this but its not working i have errors of all kind here
Screenshot please?
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.
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!
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
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 🙂
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?
I’m sorry but your “login” seperate page snippet #2 does not work. At all. The form doesn’t show up.
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?
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?
You’re right, thank you! Snippet 1 fixed 🙂
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
Hello Drew, what error did you get when your site got “broken”?
Hold on, I found the bug. Snippet 1 fixed!
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?
Good question John! Try with https://stackoverflow.com/questions/46631939/display-woocommerce-notices-on-a-page
“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
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!
It’s not working, could you please help
Hey Kapadiyah, what error are you getting?
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 ?
I can see the error there… on line 23
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.
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
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
Thank you 🙂 Maybe try using the [[woocommerce_my_account]] shortcode instead of the login one. The other issue, that’s custom work sorry!
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 🙂
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!
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.
Nice 🙂
thank
You’re welcome!
error message not showing in registration shortcode like email address already exists.
https://businessbloomer.com/woocommerce-separate-login-registration/#comment-264665