FROM CACHE - en_header

Password protecting a page or a collection

Puja_Bhargava
Tourist
11 0 4

Hi,

Is there any way to password protect a single page on the website. I know others have asked this question before, but I really couldn't find any answer other than using a paid app like Locksmith.

I'm hoping to DIY without having to use a paid app! 🙂

Thanks much!

Puja

Replies 6 (6)
StephensWorld
Shopify Expert
392 6 86

Hey Puja,

The only way I know how to do this is via the Locksmith app. The other option is to password protect the store as a whole, which you can do via the storefront password option

Best of luck with your site,

 

★ Did my post help? If yes, then please like and accept solution. ★

→ Have me build your Shopify store @ stephens.world
→ Get your FREE 30-Step Setup Guide @ stephens.world/guide
→ View My Official Expert Profile @ stephens.world/expert
→ Want to buy me lunch? stephens.world/lunch

Impress
Shopify Partner
18 1 4

Hi Puja, there's an app that does exactly what you're looking for!

https://apps.shopify.com/password-protected-pages

You can add a password to collections or individual products. And it's half the price of Locksmith 🙂

EvaM
Tourist
4 0 2

You can try this

Simply put the section that shows the price (div, paragraph, form) between : {% if customer %} --- {% endif %}.

For instance: 

product-template.liquid

{% if customer %}

<div class="h2 product-single__price">

{% if product.compare_at_price_max > product.price %}

<span class="visuallyhidden compare-price-a11y">{{ 'products.general.sale_price' | t }}</span>

{% else %}

<span class="visuallyhidden price-a11y">{{ 'products.general.regular_price' | t }}</span>

{% endif %}

<span class="product-price" {% if product.compare_at_price > product.price %} class="on-sale"{% endif %}>

{{ product.price | money }}

</span>

 

{% if product.compare_at_price_max > product.price %}

<span class="visuallyhidden price-a11y">{{ 'products.general.regular_price' | t }}</span>

<del class="compare-price">{{ product.compare_at_price_max | money }}</del>

{% endif %}

</div>

</div>

{% endif %}

Simply put the section that shows the price (div, paragraph, form) between : {% if customer %} --- {% endif %}.

For instance: 

product-template.liquid

{% if customer %}

<div class="h2 product-single__price">

{% if product.compare_at_price_max > product.price %}

<span class="visuallyhidden compare-price-a11y">{{ 'products.general.sale_price' | t }}</span>

{% else %}

<span class="visuallyhidden price-a11y">{{ 'products.general.regular_price' | t }}</span>

{% endif %}

<span class="product-price" {% if product.compare_at_price > product.price %} class="on-sale"{% endif %}>

{{ product.price | money }}

</span>

 

{% if product.compare_at_price_max > product.price %}

<span class="visuallyhidden price-a11y">{{ 'products.general.regular_price' | t }}</span>

<del class="compare-price">{{ product.compare_at_price_max | money }}</del>

{% endif %}

</div>

</div>

{% endif %}


@Puja_Bhargava wrote:

Hi,

Is there any way to password protect a single page on the website. I know others have asked this question before, but I really couldn't find any answer other than using a paid app like Locksmith.

I'm hoping to DIY without having to use a paid app! 🙂

Thanks much!

Puja


 

VendorX
New Member
1 0 0

Have you tried this ? Is it working?  I have the theme "Supply". It will work if I copy-paste to the theme editor?

Karen_Joslin1
Excursionist
18 1 4

I found this solution that sounds pretty simple: https://www.sunbowlsystems.com/blogs/how-to/how-to-create-a-private-collection-for-tagged-customers

The way it works, it seems like it should apply to any type template (collection, page, blog, etc.). I haven't tried it, though.

prpwebs
New Member
3 0 0
{% if customer.has_account == true %}
     
        {% section 'collection' %}   
 
{% else %}
 
<div class="showMessage">
 
        <section id="Login" class="account">
              <section class="col">
                <div class="login">
                    <h2 class="theme">Log In</h2>
                    <p>*only for active user.</p>
                    {% form 'customer_login' %}
                  <input type="hidden" name="checkout_url" value="/collections/private-collection">
                  {% if form.errors %}
                    <div class="form-field">
                    {{ form.errors | default_errors }}
                    </div>
                   {% endif %}
                    <div class="form-field">
                        <label for="customer_email">{{ 'customer.login.email' | t }}</label>
                        <input type="email" value="" name="customer[email]" id="customer_email"
                          class="{% if form.errors contains 'email' %}input-error{% endif %}"
                          placeholder="{{ 'customer.login.email' | t }}"
                          spellcheck="false"
                          autocomplete="off"
                          autocapitalize="off"
                          autofocus>
                    </div>
                    {% if form.password_needed %}
                    <div class="form-field">
                        <label for="customer_password">{{ 'customer.login.password' | t }}</label>
                        <input type="password" value="" name="customer[password]" id="customer_password"
                          class="password"
                          class="{% if form.errors contains 'password' %}input-error{% endif %}"
                          placeholder="{{ 'customer.login.password' | t }}">
                        <div class="forgot-password">
                            <a href="#recover" onclick="showRecoverPasswordForm()">{{ 'customer.login.forgot_password' | t }}</a>
                        </div>
                    </div>
                    {% endif %}
                    <div class="form-field action-bottom">
                        <input class="btn" type="submit" value="{{ 'customer.login.sign_in' | t }}" />
                        <span class="note" style="border: 1px solid #000 !important; padding: 13px 13px 13px 3px;">&nbsp; <a href="{{ shop.url }}">{{ 'customer.login.cancel' | t }}</a></span>
                    </div>
                    {% endform %}
                </div>
 
                
              </section>
         
          </section>
  
                    <br/>
                  
</div> 
 
{{ pages.no-access.content }}
 
{% endif %}