Website Building » WooCommerce » How do I create a custom login and registration page in WooCommerce?

How do I create a custom login and registration page in WooCommerce?

Last updated on January 10, 2023 @ 12:05 am

Creating a custom login and registration page in WooCommerce is a simple process. First, create a new page in your WooCommerce website.

Copy and paste the below code into the body of your new page.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My WooCommerce Login Page</title>
</head>

<body>
<h1>My WooCommerce Login Page</h1>
<form action=""><div>
<label for="username">Username</label>
<input type="text" id="username" class="form-control" placeholder="username">
</div>
<div>
<label for="password">Password</label>
<input type="password" id="password" class="form-control" placeholder="password">
</div>
<button type="submit">Register</button>
</form>
</body>
</html>

Now, you need to create a file called register.php in your WooCommerce website.

Copy and paste the below code into this file.

<?php
* Register page for WooCommerce
require_once './woo_commerce.php';
// GET the current logged-in user
$current_user = wc_get_current_user();
$current_user = wc_get_current_user();
if (!$current_user) {
echo "Please login to continue.";
// If the user is already logged in, set the redirect URI
elseif ($current_user->ID == wc_get_current_user_id()) {
echo "You are already logged in. <a href='logout.php'>Logout</a>";
// Redirect the user if they're already logged in
PRO TIP: If you are not a developer or familiar with code, then this is not the right question for you. Customizing WooCommerce login and registration can be complex and requires knowledge of PHP, HTML, CSS, and WordPress. If you don’t feel comfortable doing this, we recommend finding a developer who can help you.

Finally, you need to add a register.php file to your WooCommerce website.

You can now use this register.php file to create a new user account in WooCommerce.

Simply enter your username and password into the form fields, and click the “Register” button. You will now be redirected to your custom login page.

Drew Clemente

Drew Clemente

Devops & Sysadmin engineer. I basically build infrastructure online.