Site access - Create a members-only store

TyW
Community Manager
556 38 1001

You can create a members-only store by showing a login or register page when customers navigate to your website. To make your store accessible only to registered customers, you need to edit your Customer accounts settings in the admin, and add some Liquid code to your theme.

 

Note: If you want only certain pages to be members-only, then you need to install an access management app from the Shopify App Store.

 

Enable customer accounts

  1. From your Shopify admin, go to Settings > Checkout.
  2. In the Customer accounts section, click Accounts are required:

    members-01.jpg

  3. Click Save.

Edit your theme.liquid file

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, and then click Actions > Edit code.
  3. In the Layout directory, click theme.liquid.
  4. Find the opening <head> tag in the code. On a new line below the opening <head> tag, paste the following code:

    {% unless customer %}
    {% if template contains 'customers' or request.path == "/challenge" %}
    {% assign send_to_login = false %}
    {% else %}
    {% assign send_to_login = true %}
    {% endif %}
    {% endunless %}{% if send_to_login %}
    <meta content="0; url=/account/login?checkout_url=/" http-equiv="refresh" />
    {% else %}
  5. Find the closing </body> tag in the code. On a new line below the closing </body> tag, paste the following code:

    {% endif %}
  6. Click Save.

Change the page that logged-in customers are redirected to (optional)

Customers that log in are automatically redirected to the home page of the shop. You can edit where customers are redirected by editing the meta refresh tag URL in the code you just pasted.

  1. Find the following <meta> tag in the file:

    <meta content="0; url=/account/login?checkout_url=/" http-equiv="refresh" />
  2. Add the URL path you'd like to use just after checkout_url=/. For example, if you want your logged-in customers to go to your catalog page when they navigate to your site, add collections/all to the URL path. Your code should look like this:

    <meta content="0; url=/account/login?checkout_url=/collections/all" http-equiv="refresh" />
  3. Click Save.

TyW | Online Community Manager @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Replies 42 (42)
ALIAS
New Member
2 0 0

how can you make the login page accept payment to create an account?

kantankaJewels
New Member
2 0 0

i've done this but now when i try to click create an account nothing happens. 

 

When i disable customer accounts the main page doesn't even load. in order to make the main page load i've enabled customer accounts but noting happens when i click create an account. 

 

how do i get customers to request an account?

 

 

i've copied the contents of customers/login.liquid over customers/register.liquid effectively removing the original content of customers/register.liquid.

 

 

how do i get customers to request an account?

kantankaJewels
New Member
2 0 0

How would you add the "approved" tag to customers?

 

where would you see the new customer registrations to approve them?

 

Right now i have a registration page that allows people to sign up and automatically browse after signing up. I'd like to approve them before they're allowed to browse the store, after uploading some identifying documents.

michael-helium
Shopify Expert
232 2 120

There are two distinct problems mentioned on this thread:

  1. Collecting additional information from customers in order to approve their account as a wholesaler
  2. Locking unauthorized customers out of certain parts of the storefront (products/pricing, collections, navigation items, etc.)

Collecting customer information

You'll most likely need to use an app like Customer Fields (see this post about why an app is required to store data to a customer account on Shopify.)

Customer Fields enables you to:

  • create unique registration form(s) 
  • collect important information from customers
  • organize/segment customers
  • manage customer tags

All of these are important steps in the process of approving new wholesale customers and restricting unauthorized access to wholesale products or pricing.

Locking unauthorized customers out

To restrict access to your store, you will either need to follow the tutorial on this thread or use an app like Locksmith. There are many guides (such as this one) that demonstrate how to hide products/collections using Liquid code (usually based on customer tags), but no code solution is "one size fits all".

This is why we recommend using the Locksmith app; it's a powerful and flexible tool specifically built for access control.

Here's a snapshot into an ideal flow used by many wholesale merchants:

  1. Use Customer Fields to create unique registration form(s) to collect important information from your wholesale customers
  2. Enable account approval so you can review/approve customers before an account is created on Shopify
  3. Automatically tag customers (eg: “B2B”) who complete your wholesale registration form (if using account approval, the tags are added to Shopify after customers are approved)
  4. Use Locksmith to restrict access to the entire store, certain products, collections, menu items, etc. based on customer tags

Keep in mind that the flow above is just one example -- there are lots of other use-cases and flows that can be handled as well!

Michael, Former Director of Business Development @ Helium (view current profile)
- Customer Fields ✪ 4.9/5 (242 reviews)
- Meteor Mega Menu ✪ 4.7/5 (203 reviews)
michael-helium
Shopify Expert
232 2 120

@kantankaJewels 

The account approval and auto-tagging features of the Customer Fields app sound like a perfect solution for you.

Michael, Former Director of Business Development @ Helium (view current profile)
- Customer Fields ✪ 4.9/5 (242 reviews)
- Meteor Mega Menu ✪ 4.7/5 (203 reviews)
Jrogers
New Member
1 0 0

Hi there - I love your work here and it's very helpful.

I'm looking to use this but also allow customers to access only one other page via a link on this password/login page. I want them to submit an application to be a part of the member's only website. How do I give them access to only that one other page? Let me know if you have any questions.

michael-helium
Shopify Expert
232 2 120

@Jrogers if you're using Customer Fields I recommend reaching out to the support team via the in-app chat widget or by contacting support@heliumdev.com

To restrict access to a certain page you can hire a Shopify Expert to add some simple Liquid logic or use the Locksmith app. It would be easy enough to put a link in the customer's account page where they can access the member-only page after they've logged in. Our team also offers additional services exclusively for Customer Fields app users so you might consider that route as well.

Michael, Former Director of Business Development @ Helium (view current profile)
- Customer Fields ✪ 4.9/5 (242 reviews)
- Meteor Mega Menu ✪ 4.7/5 (203 reviews)
michaelh730
New Member
1 0 0

How do I edit the code to require customers to register / login on the shopping (product page) only? I want the rest of the website open to anyone, but I need to require customers to login or register in order to view the "Shop / Product Collection" Page of my website. I would rather edit the code to make this change versus paying a monthly subscription fee for an access management app. 

 

Thanks,
Mike 

michael-helium
Shopify Expert
232 2 120

@michaelh730 check out this post which shows how to determine whether a customer is logged in or not. It shouldn't be much more work than that to redirect the customer to register/login. If you're not comfortable with Liquid use the Locksmith app or hire a Shopify Expert to code this in for you. 

Michael, Former Director of Business Development @ Helium (view current profile)
- Customer Fields ✪ 4.9/5 (242 reviews)
- Meteor Mega Menu ✪ 4.7/5 (203 reviews)
afp1978
New Member
2 0 0

I like your idea of disabling account sign ups from the landing page. I would like to keep my store invite only to start so I would like to disable the create account link on the home page lander. Do you know how to do that?