How To Add A Register / Login Link In WooCommerce
Adding Register Link In WooCommerce. A 5 minute job oh & it’s free
If you’re anything like me, I like to have things clean on a website. Sure this site is quite sparse in terms of content that’s for sure, however it’s early days and more and more content will be added over time. That being said, one thing that I find a little annoying using WooCommerce is having to use the My Account page and let people register or login from there.
There’s nothing bad about it you understand and for this tutorial we will still be using the same page, or whatever you have renamed your page to. It’s mainly for aesthetics sake it would be nice to add a link to your menu bar with the words Register / Login or maybe both. Well there is a very easy fix for this, very easy.
You will not need to hack / splice or insert code, nor will you have to mess around for hours on end. This quick fix can be done in a matter of minutes. But wait! I want the menu item to say something else once they have logged in! Don’t worry we’ll show you how to do that as well.
If you wanted to see how some people do it you can take a look at this article on WooThemes, although it will involved tinkering with code and such. If you don’t want to hack away read on.
Register Link or a Log in Link Menu items.
Once you have decided what you want to add to your menu of choice, whether you name it Register / Login or have two separate items such as Register as one and Login as another, we will of course be using the same page. The My Account page, you can of course rename this page to what ever you want in fairness. I have noticed through experience that a lot of people like to see a visible ‘Register’ or indeed ‘Login’ menu item.
So we are going to use a WordPress plugin for this. Namely Nav Menu Roles, it’s available on WordPress.org here. Basically this plugin hides items from the menu, it does not physically remove them so they can no longer be accessed it merely masks them. Which is really all that we need. So search via the WP back-end plugin section for Nav Menu Roles or download from WordPress.org.
Install the plugin as usual, you might be a little lost at this point and stuck for where to go. Worry not though, you need to head on over to your admin sidebar and hover over appearance and click on menus. You will then be greeted with the below when opening a menu:
As you can see from the above just using the about menu for meediafy, you have a couple of options available. They are Display mode, under this you can tell this menu item to be displayed for Logged In Users, Logged Out Users or Everyone.
So if you can image this link item as being the ‘My Account’ page you can hide it to only display to those who are logged in. You can then create two more links or one more seperated by a /. So for this example you would create a new custom link called Register (see below).
As you can see from the above, we have created a custom link entitled ‘Register’ we have used the ‘My Account’ page as the URL so if a user is on a product page it will take them to the My Account page to create an account. If you wanted to you could call this menu item Register / Login or create another custom link specifically for logging in.
Displaying Custom Links To Users Who Are Logged In & Those Who Are Not
By hiding the My Account page to show to only those that are logged in and only showing your custom register link to those who are not logged in it cleans up the menu nicely and of course provides clear navigation to those who are new to your site and used to seeing Register / Login. Granted it’s a minor fix, however I think it’s a rather useful one for those who are looking to offer a call to action in there main navigation or even a custom menu in a sidebar.
Showing a Log Out Link In The Main Navigation For WooCommerce
Another minor bug bear is the fact you have to visit the My Account page to log out. Well do not fear, there’s a solution for that to. If you’re logged into your WooCommerce powered website head on over to the My Account page. About for words in you will see the words Log Out.
Simply hover and copy the URL itself it should be something like http://yourstore.com/my-account/customer-logout/ add this as a custom link in your menu of choice and select the option to only show to logged in users. Thus making logging in, registering and of course logging out a breeze.
Getting Creative With Nav Menu Roles
You can have strong calls to action throughout your website for sure, with things like ‘Sign Up For Exclusive Deals’ and alike, so you could add a link to a deals page for those that have logged in. There’s no real fear of duplicate content as you are effectively linking to the same page, just in a different way, it’s the same link, just with different text.
You could choose to only show a menu item to customers that are logged in and signed up with the title EXCLUSIVE DEALS, add in some text on the page itself to thank them for signing up and offer them a discount or whatever you wish to do.
Massive props to Kathy Darling the creator of this plugin. I do hope this post helped you clear up the register link in WooCommerce, told you it was a 5 minute fix, maybe less than that 😉