Reserve Your Free Seat for Our Next WooCommerce Class! Search
Business Bloomer
  • Join
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • 0
  • Business Bloomer Club
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • Search
  • Contact
  • Cart
WooCommerce Code Snippets Customer Login Customer Registration My Account

WooCommerce: Show/Hide Registration Form on Login Page

Last Revised: Dec 2025

STAY UPDATED

WooCommerce by default displays both login and registration forms on the same page when “Allow customers to create an account“ is enabled on the My Account page.

However, for a cleaner and more user-friendly experience, you may want to hide the registration form initially and show it only when users click on the “Don’t have an account?” link. This method keeps the interface focused while still allowing easy access to the registration option.

In this tutorial, we will use PHP and jQuery to modify the WooCommerce login/register page. We’ll insert a toggle link below the login form and ensure the registration form remains hidden until clicked.

This approach enhances usability, especially for stores where most visitors are returning customers and primarily need to log in. Below, you’ll find the necessary code to implement this functionality.

PHP / jQuery Snippet: Toggle Login & Registration Form @ My Account Page

This WooCommerce customization toggles the registration and login forms on the My Account page. When registration is enabled in WooCommerce settings, a “No account? Register here” link appears below the login form, allowing users to switch to the registration form without reloading the page.

Similarly, a “Already have an account? Log in here” link appears below the registration form, letting users return to the login form.

This is achieved using jQuery to hide the registration form initially and toggle visibility when the links are clicked. The script improves user experience by keeping the My Account page clean and interactive, making it easier for customers to switch between login and registration.

The code ensures both forms remain functional and properly styled by adjusting their default classes. This enhancement is particularly useful for stores that want to simplify the account access process and improve conversion rates.

/**
 * @snippet       Toggle Registration / Login Forms @ My Account
 * @tutorial      https://businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 10
 * @community     https://businessbloomer.com/club/
 */

add_action( 'woocommerce_login_form_end', 'bbloomer_my_account_registration_show_onclick' );

function bbloomer_my_account_registration_show_onclick() {
	
	if ( 'yes' !== get_option( 'woocommerce_enable_myaccount_registration' ) ) return;
	
    echo '<p><a href="#" id="show-registration">No account? Register here</a></p>';
	
	wc_enqueue_js( "
	
		var loginForm = $('#customer_login > .u-column1').removeClass('col-1');
		var regForm = $('#customer_login > .u-column2').removeClass('col-2');		
        regForm.hide();

        $('#show-registration').click(function(e) {
            e.preventDefault();
            loginForm.slideToggle();
			   regForm.slideToggle();
        });
		
	" );
	
}

add_action( 'woocommerce_register_form_end', 'bbloomer_my_account_login_show_onclick' );

function bbloomer_my_account_login_show_onclick() {
	
	if ( 'yes' !== get_option( 'woocommerce_enable_myaccount_registration' ) ) return;
	
    echo '<p><a href="#" id="hide-registration">Already have an account? Log in here</a></p>';
	
	wc_enqueue_js( "
	
		var loginForm = $('#customer_login > .u-column1');
		var regForm = $('#customer_login > .u-column2');		

        $('#hide-registration').click(function(e) {
            e.preventDefault();
            loginForm.slideToggle();
			   regForm.slideToggle();
        });
		
	" );
	
}

Now that the snippet is installed, let’s take a look at two screenshots!

Screenshot 1: My Account Page [Logged Out] On Load

On load, the My Account page displays the standard WooCommerce login form – while the registration form is hidden.

The login form consists of two input fields for the email/username and password, along with a “Log in” button. Below the password field, there is a “Lost your password?” link for users who need to reset their credentials. At the bottom, you see the new “No account? Register here” link, inviting new users to switch forms.

The registration form remains hidden at this stage, keeping the layout clean and focused on returning customers.

Screenshot 2: My Account Page [Logged Out] On “No account? Register here” Click

After clicking the “No account? Register here” link, the login form smoothly slides up and hides, while the registration form appears in its place.

The registration form contains fields for the user’s email and password, mirroring WooCommerce’s default structure. At the bottom of this form, a “Already have an account? Log in here” link appears, allowing users to switch back to the login form if needed.

The transition between forms happens seamlessly, improving usability and providing a more intuitive experience for customers signing up for the first time.

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Separate Login, Registration, My Account Pages
    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…
  • WooCommerce: Add New Tab @ My Account Page
    One of the features of Business Bloomer Club is the provision of Premium WooCommerce Q&A Support to supporters who enroll. So, how to add an…
  • WooCommerce: How To Make A Website GDPR Compliant? (12 Steps)
    Ok, we all know that the EU General Data Protection Regulation (GDPR) will come into force on the 25th May 2018. So the main question…
  • WooCommerce Visual Hook Guide: My Account Pages
    Hey WooCustomizers, the Visual Hook Guide is back 🙂 In this episode, I’ve created a visual HTML hook guide for the WooCommerce Account Pages (there…
  • WooCommerce: Add First & Last Name to My Account Register Form
    Here’s yet another useful PHP snippet – and a mini-plugin alternative with super simple settings – that adds the Billing First Name and Billing Last…

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

4 thoughts on “WooCommerce: Show/Hide Registration Form on Login Page”

  1. Rene
    April 9, 2025

    Hi when i try to insert this code in Fluent snippets i displays this error:

    Unmatched ‘)’ on line 31

    Reply
    1. Rodolfo Melogli
      April 18, 2025

      Hi Rene, what’s on line 31?

      Reply
      1. Alon Eitan
        November 10, 2025

        A small bug – At the end of each function (bbloomer_my_account_registration_show_onclick + bbloomer_my_account_login_show_onclick) you’re closing it with “});” instead of just “}”

        Reply
        1. Rodolfo Melogli
          December 2, 2025

          Thanks a lot! Fixed 🙂

          Reply
Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. 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 the Business Bloomer Club to get quick WooCommerce support. Thank you!

Cancel reply

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


Search WooCommerce Tips

Popular Searches: Visual Hook Guides - Checkout Page - Cart Page - Single Product Page - Add to Cart - Emails - Shipping - Prices - Hosting

Recent Articles

  • WooCommerce: Simple Price Including/Excluding Tax Switcher
  • WooCommerce: Refund Request Button @ My Account
  • WooCommerce: Show or Hide Bank Accounts Based On Order
  • WooCommerce: Save Order Currency Exchange Rate
  • WooCommerce: Get Orders Containing a Specific Product

Latest Comments

  1. Rodolfo Melogli on WooCommerce: Add Checkout Fee for a Payment Gateway (e.g. PayPal)
  2. Rodolfo Melogli on WooCommerce Orders With No Customer and Zero Value
  3. Johnny on WooCommerce Orders With No Customer and Zero Value

Find Out More

  • Become a WooCommerce Expert
  • Business Bloomer Club
  • WooCommerce Blog
  • WooCommerce Weekly
  • 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:

Twitter: @rmelogli

Get in touch: Contact Page

Business Bloomer © 2011-2025 - VAT IT02722220817 - Terms of Use - Privacy Policy

Cart reminder?

x