Using Liquid to enhance the member experience
How to use membership tags in Shopify Liquid to create a member paywall or create other member experiences
Here are the rules for we apply membership tags: article
You can use membership tags to enhance the member experience on Shopify, including creating exclusive content for members through a paywall.
In this guide, we'll walk you through creating a member paywall using Shopify Liquid.
This will allow you to restrict certain content to members only, enhancing the value of your membership program.
Here's how to set up a member paywall in Shopify:
-
Create a new template for gated content:
Navigate to Themes > Customize > Edit Code > Templates
Click "Add a new template" and choose "page" as the template type. Name it "page.member-content" (or any name you prefer).
-
Add the following code to your new template:
{% layout 'theme.liquid' %}
<div class="page-width">
<div class="grid">
<div class="grid__item medium-up--five-sixths medium-up--push-one-twelfth">
<div class="section-header text-center">
<h1>#{{ page.title }}</h1>
</div>
<div class="rte">
{% if customer %}
{% assign is_member = false %}
{% for tag in customer.tags %}
{% if tag == 'Withfriends' %}
{% assign is_member = true %}
{% break %}
{% endif %}
{% endfor %}
{% if is_member %}
<h2>Welcome, Member!</h2>
#{{ page.content }}
{% else %}
<h2>Upgrade Your Account</h2>
<p>This content is only available to members. Please upgrade your account to access.</p>
<!-- Add a link or button to upgrade -->
<a href="https://withfriends.co/thyme_teas/join" class="btn">Become a Member</a>
{% endif %}
{% else %}
<h2>Please Log In</h2>
<p>You need to be logged in to access this content. If you're a member, please log in.</p>
<!-- Login form with custom redirect -->
{% form 'customer_login' %}
#{{ form.errors | default_errors }}
<input type="hidden" name="checkout_url" value="#{{ request.path }}">
<label for="customer_email">Email</label>
<input type="email" name="customer[email]" id="customer_email" />
<label for="customer_password">Password</label>
<input type="password" name="customer[password]" id="customer_password" />
<input type="submit" value="Sign In" />
{% endform %}
{% endif %}
</div>
</div>
</div>
</div>
3.. Create a new page with exclusive content:
-
Go to Online Store > Pages
-
Click "Add page"
-
Enter your title and content
-
Under "Template", select the new template you created (e.g., "page.member-content")
-
Save the page
Now, when visitors access this page:
-
Non-logged-in users will see a login form
-
Logged-in non-members will see an upgrade prompt
-
Members (with the 'Withfriends' tag) will see the exclusive content
This code checks for the 'Withfriends' tag to target all members. Adjust this if you want to target a different tag for a specific membership tier, by using the name of the specific membership tier instead of 'Withfriends'.
Other ideas:
You can use member tags to customize various aspects of your store, such as:
-
Displaying different product prices for members
-
Adding a thank you message for members during checkout
-
Offering exclusive products to members only
By leveraging Shopify Liquid and membership tags, you can create a more personalized and valuable experience for your members, encouraging customer loyalty and increasing the appeal of your membership program.