How to Password Protect shopify store

How to Password Protect Shopify Store: A Simple Step-By-Step Guide

Table of Contents

    How to Password Protect Your Whole Shopify Store

    You can password-protect your whole Shopify store by following these steps:

    • Log in to your Shopify account using your credentials.
    • On Shopify admin Dashboard, go to Sale Channels -> Online Store -> Preferences.
    • Scroll down the Restrict Store Access section and tick the Restrict access to visitors with the password box.
    • In the Password field, enter the password that allows people to enter your website. You can use this password to allow certain customers to access your website.
    • In the Message for your visitors, enter the message on the password page. The password page is the page displayed to your visitors instead of your website. You can also leave it blank.
    • Click Save.
    How to Password Protect shopify store

    To unblock your store, simply untick the Restrict Access to Visitors button in the password box.

    How to Change your Shopify Password Page Settings

    Shopify has a default password protect page so you don’t really need to do anything. However, if you want to spice things up like revealing new products, you can mess with the Password Page settings for more. Here is how you can do it:

    • On Shopify admin Dashboard, go to Sale Channels -> Online Store -> Themes.
    • Click Customize on the theme you want to edit. 
    How to Password Protect shopify store
    • At the top of the page, click on the drop-down menu that displays Homapge. Type “password” into the search bar. 
    How to Password Protect shopify store

    Now you can edit the password page, follow these steps:

    • Click on the section you want to edit.
    • Makes changes to the section using the left sidebar.
    • Click Save.
    How to Password Protect shopify store

    How to Password Protect Only for Specific Pages

    It takes a little more work to create a password for only specific pages but it can be done. You will have to mess with the code of the theme, so it is best that you make a backup version of it first.

    We recommend that you reach out to a Shopify expert for such requirement to avoid unwanted hassel.

    If you still want to do it yourself then here is how we password-protect specific pages on Shopify.

    Step 1: Create Metafield Definition for the Page Password

    • On Shopify Admin Dashboard, go to Settings on the bottom left of the page.
    • On the left sidebar, choose Custom Data -> Pages and click on Add Definition.
    how to password protet shopify store for specific page
    • Make sure the Namespace and key field is set to custom.password.
    • Click on Select type and choose Single line text.
    how to password protet shopify store for specific page
    • Scroll down and make sure Storefonts access is enabled then click Save.

    Step 2: Set the password for the page you want to protect

    • Go to Online Store -> Pages and click on the page you want to protect.
    • Scroll down to the Metafields section and click Show all.
    • In the password metafield section, enter your desired password value.
    how to password protet shopify store for specific page

    Step 3: Set up the password page (coding required)

    • Go to Online Store -> Themes -> Actions and choose Edit code.
    • Use the search bar on the left sidebar and search for “page.json”
    • If you don’t find the “page.json” file, you can search for the “page.liquid” file instead.
    • Paste the Liquid code we provide below at the top of the file.
    how to password protet shopify store for specific page

    Paste this code at the top of the file:

    {% capture contentForQueryString %}{{ content_for_header }}{% endcapture %}

      {% assign pageParams = contentForQueryString

        | split: '"pageurl":"'

        | last

        | split: '"'

        | first

        | split: '.myshopify.com'

        | last

        | split: '?'

        | last

        | replace: '\/', '/'

        | replace: '%20', ' '

        | replace: '\u0026', '&'

        | split: '&'

      %}

    ‍

    {% for param in pageParams %}

      {% if param contains 'password=' %}

      {% capture pagePassword %}{{ param | split: '=' | last }}{% endcapture %}

      {% endif %}

    {% endfor %}

    • For the next step, search for “{{ page.content }}” in the same file and post the following code above it.
    how to password protet shopify store for specific page
    Paste this code at the top of the file:

      {% else %}

        {% if pagePassword %}

        {{ section.settings.wrong_password_prompt_text }}

        {% else %}

        {{ section.settings.password_prompt_text }}

        {%  endif %}

        <input type="password" id="password-input" class="field__input" placeholder="Password" autofocus autocomplete="off" onkeypress="if(event.keyCode == 13){ window.location.href = '{{ request.path }}?password=' + this.value; }"/>

        <button type="button" class="button" onclick="window.location.href = '{{ request.path }}?password=' + document.querySelector('#password-input').value;">{{ section.settings.submit_password_text }}</button>

      {% endif %}

      • In the same file, search for {% schema %}, then paste the following lines below the “settings: [” line :

      {

        "id": "password_prompt_text",

        "type": "text",

        "label": "Text to tell visitor to input password",

        "default": "Please input password to view this page"

      },

      {

        "id": "wrong_password_prompt_text",

        "type": "text",

        "label": "Text to tell visitor to input a correct password",

        "default": "Wrong password, please try again"

      },

      {

        "id": "submit_password_text",

        "type": "text",

        "label": "Text for the submit password button",

        "default": "Submit"

      },

      Step 4: Customize Text Prompts

      • Go to Online Store -> theme and click Customize.
      • Navigate to the default page template in the Theme Editor.
      • Click Pages -> Default page and then the Page section on the left sidebar.
      • Customize the text prompts for visitors on the password-protected page.
      • Save the changes.

      Step 5: Test and Implement

      Now the setup is done and things should be working but you should test it just to make sure.

      • Try entering the password-protected page; you should see a box to type password and a text prompt.
      • Try entering the wrong password and the right password to see if the page is working properly.
      • You can set passwords for other pages by adjusting the metafield value.

      5 Ways to Make Use of Password-Protected Pages for Marketing

      Exclusive Content for VIP Customers

      Create a password-protected page to offer exclusive content, such as early access to sales, special discounts, or premium resources, specifically for your VIP customers. This strategy helps foster a sense of exclusivity and rewards your most loyal customers, encouraging them to stay engaged with your brand.

      Pre-Launch Product Pages

      Use password-protected pages to share sneak peeks or early access to new products with select customers or influencers before the official launch. This can build anticipation and create buzz around your new products, generating excitement and demand even before they’re available to the public.

      password protet shopify store

      Private Sales for Subscribers

      Offer a private sale only accessible to your email subscribers or members of your loyalty program by sending them a password. This not only makes your subscribers feel valued but also drives engagement and conversion among your most interested audience.

      Exclusive Content for Partners or Affiliates

      Provide a password-protected page where partners or affiliates can access special marketing materials, promotional codes, or detailed product information. This allows you to control the distribution of sensitive information and ensure that only authorized individuals have access to important resources.

      Client-Only Resources

      For businesses offering services, create password-protected pages that house resources like tutorials, guides, or reports, exclusively available to your clients. This adds value to your services and enhances the client experience by giving them access to information that’s not available to the general public.

      >>>> Read more:

      Frequently Asked Questions (FAQs)

      How do I lock my store on Shopify?

      To lock your Shopify store and make it accessible only to those with a password, go to your Shopify admin and navigate to Online Store > Preferences. In the Password protection section, check the box to enable password protection. Enter the password you want to use, and save your changes. This will restrict access to your store, requiring visitors to enter the password to view your site.

      Can you have a password-protected collection on Shopify?

      Yes, you can create a password-protected collection on Shopify, but it requires some customization. One approach is to create a hidden collection that isn’t linked in the navigation or visible to the public. You can then create a page that links to this collection and protect that page with a password. This way, only users with the password can access the collection.

      How do I hide my Shopify store from the public?

      Go to Online Store > Preferences. Scroll down until you find the “Store Status” section and select the “Password-protected” option. This will require customers to enter a password before accessing your store. Once you have saved your changes, your store will be hidden from the public.

      How do I secure my Shopify account?

      • Enable Two-Factor Authentication (2FA): Go to Settings > Users and permissions, then follow the prompts to set up 2FA for an additional layer of security.
      • Use a Strong, Unique Password: Choose a complex password that is difficult to guess and different from passwords you use on other sites.
      • Limit Account Access: Only grant access to users who need it, and assign them the appropriate permissions based on their roles.
      • Regularly Review User Permissions: Periodically check and update user permissions to ensure that only authorized individuals have access to critical parts of your store.
      • Monitor Account Activity: Keep an eye on your Shopify account for any suspicious activities or login attempts.