Shopify themes, liquid, logos, and UX
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.
theme.liquid
.<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 %}
</body>
tag in the code. On a new line below the closing </body>
tag, paste the following code:{% endif %}
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.
<meta>
tag in the file:<meta content="0; url=/account/login?checkout_url=/" http-equiv="refresh" />
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" />
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
Hello!
First, thank you for this, it's been really helpful.
However, in the last week it's stopped working; customers just continue to get sent to the customer login page, even after login, and not to any other route. Is this code still working for you? Nothing changed code-wise from my end, so I'm wondering if something changed behind the scenes in shopify.
Thanks,
Phaedra
This is awesome, thank you. How do you then customize / edit the log-in page that non-logged in users are directed to?
Hey,
thanks for the tutorial. can you tell me how I can forward the other pages for logged in users? I don't want any user whether logged in or not, e.g. comes to the start page or collections. Only the checkout (BuyButton) and the user account should work. Many thanks
how can you make the login page accept payment to create an account?
Hi Alias, did you ever figure this out? how can you make the login page accept payment to create an account?
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.
@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.
checkout error
please help!!
Hi if we only want a portion of our site (and it's products) to be a "Members Only Area" that requires registration + login (so we can capture emails and ensure they read our Members Area Terms & Conditions) –how would we do that?
[!] Requirements/Desires:
@HouseOfEnergy
If you're comfortable with Liquid, see this post.
If not, see our blog on this topic: How to Create a Shopify Membership Site and Restrict Access to Your Shopify Store
If you're already using Customer Fields for your members-only store, contact support@heliumdev.com.
How do I make my entire store paid subscription base? This run down helps with creating a member, but what if I want them to also sign up for a monthly or yearly membership?
Hello, when I go to the Customer accounts section, click Accounts are required: I do not have the same options as you have on here. Mine are attached. I need to have my site setup where people can't see anything past the homepage until they sign in to activate the other pages. **I apologize if this has been answered but I read a lot of the comments and did not find the answer. Thanks in advance
Hi @lindsiejones - Shopify announced new customer accounts on Jan 31. Looks like the settings have changed as well. That said, there is no way to lock down your store just by toggling Shopify settings. A Shopify Developer can help you with Liquid customization to prevent access to your site, or you could use an app. I wrote a blog about apps that can help you accomplish this.
To be more precise, the setting to “require customer accounts” has been moved to Checkout settings. If you want to require all customers to login before checkout, from your Shopify admin, go to Settings > Checkout and select Require the customer to log in to their account before checkout from the Customer contact method section.
See screenshot:
Hello,
I cannot find this specific "Accounts required" customer accounts section in settings in the new Shopify summer edition. Is that possible?
@kengurugold
The setting to “require customer accounts” has been moved to Checkout settings. If you want to require all customers to login before checkout, from your Shopify admin, go to Settings > Checkout and select Require the customer to log in to their account before checkout from the Customer contact method section.
Here's a screenshot:
Source: https://heliumdev.com/blog/shopify-enable-customer-accounts
User | RANK |
---|---|
141 | |
113 | |
79 | |
64 | |
63 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023