How can I restrict content to a specific membership tier?
By enabling the "Restricted Content" perk within Conjured Memberships, you can restrict pages, collections, individual products, blogs, and specific articles to be visible to members only:
In order for this perk to work, you'll need to edit your theme. The easiest way to do this is to have Conjured Memberships add the content for you. To do that, simply click the "Add it for me button". You'll be prompted to confirm that you have taken a backup of your live theme, so that you can always roll back to it if necessary, and then Conjured Memberships will add two bits of code to your theme template.
The first bit of code is a file called cm_restricted_content.liquid, which will show up in your snippets folder within your theme. This file contains all the logic that determines whether a customer is logged in, if they're a member, and if they're a part of the correct tier to view the page.
The second bit of code is a small addition to your theme.liquid file in your layouts folder. Just before the closing </head> tag, the new snippet created is included.
Once the theme has been modified, you can use the page selector on your Perks tab to select which pages you want to hide:
You can select individual products or collections to hide, which will also hide any products included in them. You can also opt to hide products based on a tag:
You can also opt to hide blogs and all their articles, or just certain articles based on a tag:
You'll also want to specify messages to display to your users if they try to access a page without the proper permissions. There are 3 types of gateway messages:
-
User is not logged in: This message is displayed when a user is not logged in and tries to access a page that is restricted.
-
User is not a member: This message is displayed when the customer is logged in, but is not a member.
-
User is not a tier member: This message is displayed when the customer is logged in and is a member, however they don't belong to the correct tier. For example, if you have a Bronze and a Silver tier, and you restrict a page for the Silver tier only, Bronze members would see this error message.
Be sure to save your changes once you're finished.
Advanced Instructions
If there are specific parts of the site you'd like to restrict, and you are comfortable editing liquid files, you can use the following code as a wrapper around the content you want to restrict:
{% if customer %} {% if customer.tags contains 'YOUR_MEMBERSHIP_TAG' %} {% if customer.tags contains 'YOUR_TIER_TAG' %} YOUR RESTRICTED CONTENT HERE {% else %} You must be a member of a specific tier to view this content. {% endif %} {% else %} You must be a member to view this content. {% endif %} {% else %} You must be logged in to view this content. {% endif %}
Replace YOUR_MEMBERSHIP_TAG and YOUR_TIER_TAG with the correct tags for your membership and tier. To find these tags, you can look at the Custom Perk option on the Perks tab:
If you have any trouble restricting content, don't hesitate to contact us at support@conjured.co!