Skip to content
Locked Content - Free Tutorial
Browse other ways to boost conversion rate & profit

Locked Content - Free Tutorial

Want personalized guidance adding this to your store?

Check out our Insiders community: https://www.skool.com/the-prompted

Members of The Prompted community receive a detailed store audit, 1-on-1 guidance for implementing new features, and access to an exclusive theme. You'll also get marketing support, the same tactics we use to spend over $100k/mo on Meta Ads.

---

In this video, we're showing you how to easily lock pricing on your Shopify store to only customers who log in, without any apps or knowing how to code.

By locking your pricing, you can encourage your customers to join a membership or create an account, which allows you to nurture the relationship with them.

Compatible Themes: This code should work on all free Shopify themes (Dawn, Refresh, Craft, Studio, Publisher, Crave, Origin, Taste, Colorblock, Sense, Ride, Spotlight).

 

Create metaobject and entries

Metaobject Name: Lock Pages

Fields:

  • Title: single line text
  • Products To Lock: list of products

Lock Pricing

Modify settings_schema.json

  {
    "name": "Lock Website Content",
    "settings": [
      {
        "type": "checkbox",
        "id": "enable_locked_content",
        "label": "Enable Content Locking",
        "default": false
      },
      {
        "type": "checkbox",
        "id": "lock_all_product_prices",
        "label": "Lock All Product Prices",
        "default": false
      },
      {
        "type": "checkbox",
        "id": "hide_cart_icon",
        "label": "Hide Cart Icon",
        "default": false
      },
      {
        "type": "text",
        "id": "price_locked_text",
        "label": "Text For Price Locking",
        "default": "Please log in to see pricing"
      },
      {
        "type": "text",
        "id": "atc_locked_text",
        "label": "Text For ATC Locking",
        "default": "Please log in to add to cart"
      },
      {
        "type": "text",
        "id": "lock_pages_metaobject",
        "label": "Lock Pages Metaobject Handle",
        "default": "lock-pages"
      }
    ]
  }

Modify price.liquid

{% assign lock_pages_metaobject = shop.metaobjects.lock_pages[settings.lock_pages_metaobject] %}
{% assign locked_product_ids = lock_pages_metaobject.products_to_lock.value | map: 'id' %}

{% if customer == nil and settings.enable_locked_content and settings.lock_all_product_prices %}
  <b>{{ settings.price_locked_text }}</b>

{% elsif customer == nil and settings.enable_locked_content and locked_product_ids contains product.id %}   
  <b>{{ settings.price_locked_text }}</b>
{% else %}

...existing code...

{% endif %}

Modify main-product.liquid

Extract products to lock

{% assign lock_pages_metaobject = shop.metaobjects.lock_pages[settings.lock_pages_metaobject] %}
{% assign locked_product_ids = lock_pages_metaobject.products_to_lock.value | map: 'id' %}

Modify quantity_selector and buy_buttons blocks

{% if customer == nil and settings.enable_locked_content and settings.lock_all_product_prices %}
  {% comment %}do nothing{% endcomment %}
{% elsif customer == nil and settings.enable_locked_content and locked_product_ids contains product.id %}   
  {% comment %}do nothing{% endcomment %}
{% else %}  

...existing code...

{% endif %}

Modify header.liquid

{% if customer == nil and settings.enable_locked_content and settings.hide_cart_icon %}   
  {% comment %}do nothing{% endcomment %}
{% else %}
      
...existing cart icon code...

{% endif %}

Modify card-product.liquid

Extract products to lock

{% assign lock_pages_metaobject = shop.metaobjects.lock_pages[settings.lock_pages_metaobject] %}
{% assign locked_product_ids = lock_pages_metaobject.products_to_lock.value | map: 'id' %}

Modify standard quick add button and label

  {% elsif customer == nil and settings.enable_locked_content and settings.lock_all_product_prices %}
    disabled
  {% elsif customer == nil and settings.enable_locked_content and locked_product_ids contains card_product.id %}
    disabled
{% if customer == nil and settings.enable_locked_content and settings.lock_all_product_prices %}
  {{ settings.atc_locked_text }}
{% elsif customer == nil and settings.enable_locked_content and locked_product_ids contains card_product.id %}
  {{ settings.atc_locked_text }}
{% else %}

...existing code...

{% endif %}

Modify bulk quick add button and label

{% if customer == nil and settings.enable_locked_content and settings.lock_all_product_prices  %}
    <button
      id="{{ product_form_id }}-submit"
      type="submit"
      name="add"
      class="quick-add__submit button button--full-width button--secondary"
      aria-labelledby="{{ product_form_id }}-submit title-{{ section_id }}-{{ card_product.id }}"
      data-sold-out-message="true"
      disabled
    >
      <span>{{ settings.atc_locked_text }}</span>
      <span class="sold-out-message hidden">
        {{ settings.atc_locked_text }}
      </span>
    </button>
{% elsif customer == nil and settings.enable_locked_content and locked_product_ids contains card_product.id  %}
    <button
      id="{{ product_form_id }}-submit"
      type="submit"
      name="add"
      class="quick-add__submit button button--full-width button--secondary"
      aria-labelledby="{{ product_form_id }}-submit title-{{ section_id }}-{{ card_product.id }}"
      data-sold-out-message="true"
      disabled
    >
      <span>{{ settings.atc_locked_text }}</span>
      <span class="sold-out-message hidden">
        {{ settings.atc_locked_text }}
      </span>
    </button>
{% else %}

... existing code...

{% endif %}

Modify quick-order-list.liquid

Modify the header row (quantity and and totals row (quick-order-list__total)

{% assign lock_pages_metaobject = shop.metaobjects.lock_pages[settings.lock_pages_metaobject] %}
{% assign locked_product_ids = lock_pages_metaobject.products_to_lock.value | map: 'id' %}

{% if customer == nil and settings.enable_locked_content and settings.lock_all_product_prices %}
  {% comment %}do nothing{% endcomment %}

{% elsif customer == nil and settings.enable_locked_content and locked_product_ids contains product.id %}   
  {% comment %}do nothing{% endcomment %}
{% else %}

...existing code...

{% endif %}

Modify quick-order-list-row.liquid

{% assign lock_pages_metaobject = shop.metaobjects.lock_pages[settings.lock_pages_metaobject] %}
{% assign locked_product_ids = lock_pages_metaobject.products_to_lock.value | map: 'id' %}

{% if customer == nil and settings.enable_locked_content and settings.lock_all_product_prices %}
  {% comment %}do nothing{% endcomment %}

{% elsif customer == nil and settings.enable_locked_content and locked_product_ids contains item.product.id %}   
  {% comment %}do nothing{% endcomment %}
{% else %}

...existing code...

{% endif %}

Browse other ways to boost conversion rate & profit