Create a members-only store


This is an advanced tutorial and is not supported by Shopify. Knowledge of web design languages such as HTML, CSS, Javascript and Liquid is required. We suggest hiring a Shopify Expert if you are not comfortable proceeding with the following tutorial.

To make your store accessible only to registered members, you need to add some Liquid code and enable the Customer Accounts feature. The following guide will show you how to add this functionality to your store.

Enable customer accounts

Unless you go ahead and create an account for all members, they will not be able to log in to your site. You can have them signup by adding a signup form to your login page, as described here. This sign up form will allow your visitors to sign up for an account in order to access. your site.

Make sure that you have enabled customer account logins. To do this:

  1. From your Shopify admin, click Settings, then click Checkout.

  2. In the Customer accounts section, click Accounts are required:

    Customer accts req

  3. Click Save.

Modify your theme.liquid file

  1. From your Shopify admin, click Online Store, and then click Themes (or press G W T).

  2. Find the theme you want to edit, click the ... button, and then click Edit HTML/CSS.

  3. Under the Layouts folder, locate and click on theme.liquid to open it in the online code editor.

  4. Add the following code to the top of your theme.liquid file:

    {% unless customer %}
        {% if template contains 'customers' %}
            {% 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={{ shop.url }}" http-equiv="refresh" />
    {% else %}
    ... Other theme.liquid contents should be left alone here ...
    {% endif %}

    The Liquid should look like this when you are done:

    Shopify's code editor with a snippet of Liquid code
  5. Save your changes.

Customers logging in will be redirected back to the homepage of the shop automatically. You can modify where they end up by changing the {{ shop.url }} part in the meta refresh tag.

This tutorial will create a basic customer login page. You may still want to edit the look of your customer login page. Hire a Shopify Expert to finish the design job.

Want to discuss this page?

Visit the Shopify Community