Account Pages
Overview
Heads up
- If you are using Starter Kit, there's no need need to manually create the Sections and Components below.
- All the code examples below are just an implementation suggestions. For brevity, the styles are omitted.
- For this guide, we will be creating Sections and Components locally. Make sure you have your Local Development Environment ready.
👉 Remember to commit and push newly created Sections and Components to your remote repository to sync the changes with Shogun Frontend.
This guide will walk you through implementing the account pages in your store. We will be using the Frontend Customer package.
The account pages will allow your customers to:
- Register and log in
- Manage addresses
- See order history
- Manage and reset password
For security reasons, managing payment methods is not supported using the frontend-customer package. Contact Shogun Support for an alternative approach.
Pages
Below is an overview of each page this guide will cover:
Page name | Page url | Requires authentication | Description |
---|---|---|---|
Account | /account | Yes | Customer's account page. |
Register | /account/register | No | Where customers go to create their account. |
Login | /account/login | No | Where customers go to login into their account. |
Orders | /account/orders | Yes | Where customers can see their orders. |
Address | /account/address | Yes | Where customers can see and manage their addresses. |
Forgot Password | /account/recover-password | No | Where customers go if they need to recover their password. |
Reset Password | /account/reset-password | No | The page a customer is redirected after clicking the reset password link in their email. |
AuthGuard Component
Before we start implementing the pages and sections, let's create a component that will act as a guard to protect the pages that require authentication, like the /account
and the /account/orders
page.
The AuthGuard
component will redirect your customer to a given URL if they try to access a password-protected page. Also, the AuthGuard
component will redirect your customers to their /account
page if they are already logged in and try to access the register and/or login page.
The AuthGuard
component takes 3 props
:
prop name | type | description |
---|---|---|
allowedAuthStatus | string ('authenticated' | 'unauthenticated') | The status in which the customer is authorized to access the children's component. |
redirectUrl | string | The url that the customer should be redirected to. |
children | React.ReactNode | The component that will be wrapped and protected by AuthGuard . |
To create the AuthGuard
Component:
- On your local environment, create a new folder inside
src/components
and name it asAuthGuard
. - Create an
index.js
file inside theAuthGuard
folder. - Create a
styles.module.css
file inside theAuthGuard
folder.
You can also create Sections and Components via Shogun Frontend IDE:
- Click on the Sections icon from the sidebar.
- Open any
Section
. - Click on
Components
on the left side of the screen. - Click on the + (plus sign) button to create a new
Component
. - The
IDE
will refresh with sample code. - Name the
Component
asAuthGuard
by clicking on the pencil icon button in the top left corner of your screen. When you are done, click the checkmark icon to save the name. - Click
SAVE
to save theComponent
.
To see the code example, click on the AuthGuard
recipe below:
RegisterForm Section
For Shopify stores
Make sure the Customers Accounts permission is enabled. Check Shopify documentation for more details.
Used in this Section:
Customers may not have an account to log into. Let's create a Section that will allow your customers to create an account.
To create a Section:
- On your local environment, create a new folder inside
src/sections
and name it asRegisterForm
. - Create an
index.js
file inside theRegisterForm
folder. - Create a
styles.module.css
file inside theRegisterForm
folder.
To see the code example, click on the RegisterForm
recipe below:
Register page
With the RegisterForm
Section ready, we need to create a register page:
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Register.
- Enter the PAGE PATH:
account/register
. - If desired, you can select a Frame from the Frame dropdown.
- Click ADD PAGE.
Now, add the RegisterForm
section to your Register page (if you are already on the Register page, skip to step 4):
- Click on the Pages icon from the sidebar.
- Search for "Register".
- Open the "Register" page by clicking on its title.
- On the sidebar, click on the + (plus sign) where it says "Add sections to start building your page".
- A list with all our
Sections
will appear, search for and selectRegisterForm
. - Click
SAVE
.

Register page example
LoginForm Section
Used in this Section:
Now that your customers have a way to create their accounts, they need a way to log in using their credentials.
Go ahead and create a new Section called LoginForm
:
- On your local environment, create a new folder inside
src/sections
and name it asLoginForm
. - Create an
index.js
file inside theLoginForm
folder. - Create a
styles.module.css
file inside theLoginForm
folder.
To see the code example, click on the LoginForm
recipe below:
Login page
To use the LoginForm
section, we need a Login page:
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Login.
- Enter the PAGE PATH:
account/login
. - If desired, you can select a Frame from the Frame dropdown.
- Click ADD PAGE.
Now, add the LoginForm
section to your Login page (if you are already on the Login page, skip to step 4):
- Click on the Pages icon from the sidebar.
- Search for "Login".
- Open the "Login" page by clicking on its title.
- On the sidebar, click on the + (plus sign) where it says "Add sections to start building your page".
- A list with all our
Sections
will appear, search for and selectLoginForm
. - Click
SAVE
.

Login page example
Logout on Checkout page (Shopify only)
When your customers log out on checkout page they won't be logged out in your store. Here is a recipe how to solve it:
First, create Logout
section and add following code:
import React, { useEffect } from 'react'
import { useRouter } from 'next/router'
import { useCustomerActions } from 'frontend-customer'
const Logout = () => {
const { query } = useRouter()
const { logout } = useCustomerActions()
useEffect(() => {
const { return_url } = query
if (!return_url) return
logout()
.then(() => {
sleep(2000)
window.location = return_url ? return_url : '/'
})
}, [query, logout])
return (
<h1>Logging out...</h1>
)
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default Logout
To use the Logout
section, we need a Logout page:
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Logout.
- Enter the PAGE PATH:
/logout
. - Click ADD PAGE.
- Add
Logout
section to Logout page.
Finally, you need to change Log out
link on Checkout page to navigate to newly created Logout page. Instead of current logout-url
https://store.myshopify.com/account/logout?return_url=<checkout-url>
you would put https://store.com/logout?return_url=https://store.com/logout?return_url=<logout-url>
(note if Shogun store and Checkout page are on different domains, logout url should point to Checkout domain).
With both Register and Login features in place, it's time to move to the password-protected pages.
Account Section
After your customers create their accounts and log in using their credentials, they will land at their account dashboard. The Account Section will be used within the /account
page to give your authenticated customers access to their orders, address, and more. Before we create the /account
page, let's create the Account Section.
- On your local environment, create a new folder inside
src/sections
and name it asAccount
. - Create an
index.js
file inside theAccount
folder. - Create a
styles.module.css
file inside theAccount
folder.
To see the code example, click on the Account
recipe below:
Account page
With the Account Section ready, let's create the /account
page:
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Account.
- Enter the PAGE PATH:
account
. - If you want, you can select a Frame from the Frame dropdown.
- Click ADD PAGE.
Now, add the Account
section to your Account page (if you are already on the Account page, skip to step 4):
- Click on the Pages icon from the sidebar.
- Search for "Account".
- Open the "Account" page by clicking on its title.
- On the sidebar, click on the + (plus sign) where it says "Add sections to start building your page".
- A list with all our
Sections
will appear, search for and selectAccount
. - Click
SAVE
.

Account page example
AccountAddress Section
Customers may want to manage their addresses through their account dashboard. To address this, let's create a new section that will handle adding, editing, and deleting addresses.
- On your local environment, create a new folder inside
src/sections
and name it asAccountAddress
. - Create an
index.js
file inside theAccountAddress
folder. - Create a
styles.module.css
file inside theAccountAddress
folder.
To see the code example, click on the AccountAddress
recipe below:
Address page
Create the /account/address
page:
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Address.
- Enter the PAGE PATH:
account/address
. - If you want, you can select a Frame from the Frame dropdown.
- Click ADD PAGE.
Now, add the AccountAddress
section to the Address page (if you are already on the Address page, skip to step 4):
- Click on the Pages icon from the sidebar.
- Search for "Address".
- Open the "Address" page by clicking on its title.
- On the sidebar, click on the + (plus sign) where it says "Add sections to start building your page".
- A list with all our
Sections
will appear, search for and selectAccountAddress
. - Click
SAVE
.

Address page example, adding a new address
AccountOrders Section
Similar to the address features, customers will see their order history in their account dashboard. For that, we need a new Section.
- On your local environment, create a new folder inside
src/sections
and name it asAccountOrders
. - Create an
index.js
file inside theAccountOrders
folder. - Create a
styles.module.css
file inside theAccountOrders
folder.
To see the code example, click on the AccountOrders
recipe below:
Orders page
Let's create our /account/orders
page:
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Orders.
- Enter the PAGE PATH:
account/orders
. - If you want, you can select a Frame from the Frame dropdown.
- Click ADD PAGE.
Now, add the AccountOrders
section to your Orders page (if you are already on the Orders page, skip to step 4):
- Click on the Pages icon from the sidebar.
- Search for "Orders".
- Open the "Orders" page by clicking on its title.
- On the sidebar, click on the + (plus sign) where it says "Add sections to start building your page".
- A list with all our
Sections
will appear; search for and selectAccountOrders
. - Click
SAVE
.
That concludes the password-protected pages. Let's move to the final pieces; recovering and resetting passwords.

Orders page example
ForgotPasswordForm Section
Customers can reset their password via the account dashboard, but they need to be logged in for that to happen. If they forgot their password, they can request a reset password link. To handle this use case, let's create a new section:
- On your local environment, create a new folder inside
src/sections
and name it asForgotPasswordForm
. - Create an
index.js
file inside theForgotPasswordForm
folder. - Create a
styles.module.css
file inside theForgotPasswordForm
folder.
To see the code example, click on the ForgotPasswordForm
recipe below:
Forgot password page
Create the /account/forgot-password
page:
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Forgot password.
- Enter the PAGE PATH:
account/forgot-password
. - If you want, you can select a Frame from the Frame dropdown.
- Click ADD PAGE.
Now, add the ForgotPasswordForm
Section to the Forgot password page (if you are already on the Orders page, skip to step 4):
- Click on the Pages icon from the sidebar.
- Search for "Forgot password".
- Open the "Forgot password" page by clicking on its title.
- On the sidebar, click on the + (plus sign) where it says "Add sections to start building your page".
- A list with all our
Sections
will appear; search for and selectForgotPasswordForm
. - Click
SAVE
.

Forgot password page example
ResetPasswordForm Section
After clicking the reset password link, your customers will land at the /account/reset-password
(on some stores it's account/reset
) page. On this page, they will be able to enter their new password. Let's start by creating a new section.
- On your local environment, create a new folder inside
src/sections
and name it asResetPasswordForm
. - Create an
index.js
file inside theResetPasswordForm
folder. - Create a
styles.module.css
file inside theResetPasswordForm
folder.
To see the code example, click on the ResetPasswordForm
recipe below:
Reset password page
Finally, create the account/reset-password
(on some stores it's account/reset
) page.
- Click on the Pages icon from the sidebar.
- Click ADD PAGE on the top right corner.
- Enter the PAGE NAME: Reset password.
- Enter the PAGE PATH:
account/reset-password
(on some stores it'saccount/reset
). - If you want, you can select a Frame from the Frame dropdown.
- Click ADD PAGE.
Now, add the ResetPasswordForm
section to the Reset password page (if you are already on the Reset password page, skip to step 4):
- Click on the Pages icon from the sidebar.
- Search for "Reset password".
- Open the "Reset password" page by clicking on its title.
- On the sidebar, click on the + (plus sign) where it says "Add sections to start building your page".
- A list with all our
Sections
will appear; search for and selectResetPasswordForm
. - Click
SAVE
.
Updated 4 months ago