Question: Set up app again after changing the theme
Solution:
When the Membership app is installed, additional “Snippet” files are automatically inserted into the main, published theme.
If you added or publish a new theme after the app is installed then these snippet files will need to be added to the new/updated theme along with the liquid installation.
Follow below steps for adding snippets –
Step 1. Go to Online store > Themes > Click Actions and duplicate your theme for backup.
Step 2. Now, Edit code and search for below files under “Snippets” –
aaa-collection-product-filter.liquid
aaa-memberships-collection.liquid
aaa-memberships-noaccess.liquid
aaa-memberships-page.liquid
aaa-memberships-product.liquid
aaa-memberships-template.liquid
aaa-plan_rule.liquid
aaa-product-page-filter.liquid
aaa_mem_helper.liquid
Step 3. If any of the snippets don’t exist then add it.
(a) Create a new snippet.
(b) Enter the correctly spelt snippet name without .liquid.
(c). Create snippet.
(d) Copy and paste the code found in below files respectively.
aaa-memberships-collection.liquid
{% comment %}This snippet is generated and updated by aaa Memberships.{% endcomment %}
{% assign aaa_hide_item = false %}
{% assign aaa_item_type = ‘collection’%}
{% for aaa_rule in collection.metafields.aaa_mem %}
{% if aaa_rule.last contains ‘show’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess’ %}
{% endif %}
{% endfor %}
{% for aaa_rule in collection.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess’ %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
aaa-collection-product-filter.liquid
{% for product_collection in product.collections %}
{% comment %}This snippet is generated and updated by aaa Memberships.{% endcomment %}
{% assign aaa_hide_item = false %}
{% assign aaa_item_type = ‘product’%}
{% for aaa_rule in product_collection.metafields.aaa_mem %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: aaa_rule.first %}
{% endif %}
{% endfor %}
{% for aaa_rule in product.metafields.aaa_mem %}
{% if aaa_rule.last== ‘hide’ %}
{% assign aaa_hide_item = true %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: aaa_rule.first %}
{% endif %}
{% endfor %}
{% for aaa_rule in product_collection.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: customer_tag %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% for aaa_rule in product.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: customer_tag %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor%}
aaa-memberships-noaccess.liquid
<div class=”page-width” style=”text-align:center;”>
<p> This is a “Members only” {{aaa_item_type}}. Either you do not have access or you are not logged in.</p>
</div>
aaa-memberships-page.liquid
{% comment %}This snippet is generated and updated by aaa Memberships.{% endcomment %}
{% assign aaa_hide_item = false %}
{% assign aaa_item_type = ‘page’%}
{% for aaa_rule in page.metafields.aaa_mem %}
{% if aaa_rule.last contains ‘show’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess’ %}
{% endif %}
{% endfor %}
{% for aaa_rule in page.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess’ %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
aaa-memberships-product.liquid
{% comment %}This snippet is generated and updated by aaa Memberships.{% endcomment %}
{% assign aaa_hide_item = false %}
{% assign aaa_item_type = ‘product’%}
{% for aaa_rule in product.collections.metafields.aaa_mem %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: aaa_rule.first %}
{% endif %}
{% endfor %}
{% for aaa_rule in product.metafields.aaa_mem %}
{% if aaa_rule.last== ‘hide’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: aaa_rule.first %}
{% endif %}
{% endfor %}
{% for aaa_rule in product.collections.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: customer_tag %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% for aaa_rule in product.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: customer_tag %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
aaa-memberships-template.liquid
{%comment %}This snippet is generated and updated by aaa Memberships. any changes will be overridden when the Store Owner saves a Plan in the app.{%endcomment%}
{% assign aaa_membership_partial_redirect = false %}
{% assign aaa_membership_full_redirect = false %}
{% assign mem_current_template = template %}
{%if aaa_membership_partial_redirect == true %}
<script>
top.location = (window.location.href + “?view={{aaa_membership_template}}”);
</script>
{%endif%}
{% if aaa_membership_full_redirect == true %}
<script>
aaa_url = window.location.href
top.location = aaa_url.split(“?view=”)[0];
</script>
{%endif%}
{%comment %}This snippet is generated and updated by aaa Memberships. any changes will be overridden when the Store Owner saves a Plan in the app.{%endcomment%}
{% assign aaa_membership_partial_redirect = false %}
{% assign aaa_membership_full_redirect = false %}
{% assign mem_current_template = template %}
{%if aaa_membership_partial_redirect == true %}
<script>
top.location = (window.location.href + “?view={{aaa_membership_template}}”);
</script>
{%endif%}
{% if aaa_membership_full_redirect == true %}
<script>
aaa_url = window.location.href
top.location = aaa_url.split(“?view=”)[0];
</script>
{%endif%}
aaa-plan_rule.liquid
<!–Cart Rule–>
{% assign aaa_cart_hide_item = false %}
{% assign aaa_item_type = ‘product’%}
{% for aaa_rule in shop.metafields.aaa_mem %}
{% assign key_wrd = aaa_rule.last | split: ‘,’ %}
{% if key_wrd.last == “show” %} <!–Means show anly when login–>
{% assign aaa_cart_hide_item = true %}
{% endif %}
{% endfor %}
{% for aaa_rule in shop.metafields.aaa_mem %}
{% assign key_wrd = aaa_rule.last | split: ‘,’ %}
{% for customer_tag in customer.tags %}
{% if customer_tag == key_wrd.first %}
{% if key_wrd.last == ‘hide’ %}
{% assign aaa_cart_hide_item = true %}
{% endif %}
{% if key_wrd.last == ‘show’ %}
{% assign aaa_cart_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<!–Price Rule–>
{% assign aaa_price_hide_item = false %}
{% assign aaa_item_type = ‘product’%}
{% for aaa_rule in shop.metafields.aaa_mem_price %}
{% assign key_wrd = aaa_rule.last | split: ‘,’ %}
{% if key_wrd.last == “show” %} <!–Means show anly when login–>
{% assign aaa_price_hide_item = true %}
{% endif %}
{% endfor %}
{% for aaa_rule in shop.metafields.aaa_mem_price %}
{% assign key_wrd = aaa_rule.last | split: ‘,’ %}
{% for customer_tag in customer.tags %}
{% if customer_tag == key_wrd.first %}
{% if key_wrd.last == ‘hide’ %}
{% assign aaa_price_hide_item = true %}
{% endif %}
{% if key_wrd.last == ‘show’ %}
{% assign aaa_price_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
aaa-product-page-filter.liquid
{% for product_collection in product.collections %}
{% comment %}This snippet is generated and updated by aaa Memberships.{% endcomment %}
{% assign aaa_hide_item = false %}
{% assign aaa_item_type = ‘product’%}
{% for aaa_rule in product_collection.metafields.aaa_mem %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: aaa_rule.first %}
{% endif %}
{% endfor %}
{% for aaa_rule in product.metafields.aaa_mem %}
{% if aaa_rule.last== ‘hide’ %}
{% assign aaa_hide_item = true %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: aaa_rule.first %}
{% endif %}
{% endfor %}
{% for aaa_rule in product_collection.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: customer_tag %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% for aaa_rule in product.metafields.aaa_mem %}
{% for customer_tag in customer.tags %}
{% if customer_tag == aaa_rule.first %}
{% if aaa_rule.last == ‘hide’ %}
{% assign aaa_hide_item = true %}
{% assign aaa_noaccess_snippet = ‘aaa-memberships-noaccess-‘ | append: customer_tag %}
{% endif %}
{% if aaa_rule.last == ‘show’ %}
{% assign aaa_hide_item = false %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor%}
{% if aaa_hide_item == true %}
{% include ‘aaa-memberships-noaccess’ %}
{% break %}
{% endif %}
aaa_mem_helper.liquid
{% if aaa_mem_helper == ‘product’ %}
{%include ‘aaa-memberships-template’ %}
{% if aaa_membership_partial_redirect != true and aaa_membership_full_redirect != true %}
{%include ‘aaa-memberships-product’ %}
{% if aaa_hide_item == true %}
{%include aaa_noaccess_snippet %}
{% break %}
{% endif %}
{% else %}
{% break %}
{% endif %}
{%endif%}
{% if aaa_mem_helper == ‘collection’ %}
{%include ‘aaa-memberships-template’ %}
{% if aaa_membership_partial_redirect != true and aaa_membership_full_redirect != true %}
{%include ‘aaa-memberships-collection’ %}
{% if aaa_hide_item == true %}
{%include aaa_noaccess_snippet %}
<p class=”btn_mem”><a href=”/pages/membership-wholesale-registration”>Become A Member</a></p>
{% break %}
{% endif %}
{% else %}
{% break %}
{% endif %}
{%endif%}
{% if aaa_mem_helper == ‘page’ %}
{%include ‘aaa-memberships-template’ %}
{% if aaa_membership_partial_redirect != true and aaa_membership_full_redirect != true %}
{%include ‘aaa-memberships-page’ %}
{% if aaa_hide_item == true %}
{%include aaa_noaccess_snippet %}
{% break %}
{% endif %}
{% else %}
{% break %}
{% endif %}
{%endif%}
{% if aaa_mem_helper == ‘article’ %}
{%include ‘aaa-memberships-template’ %}
{% if aaa_membership_partial_redirect != true and aaa_membership_full_redirect != true %}
{%include ‘aaa-memberships-article’ %}
{% if aaa_hide_item == true %}
{%include aaa_noaccess_snippet %}
{% break %}
{% endif %}
{% else %}
{% break %}
{% endif %}
{%endif%}
{% if aaa_mem_helper == ‘blog’ %}
{%include ‘aaa-memberships-template’ %}
{% if aaa_membership_partial_redirect != true and aaa_membership_full_redirect != true %}
{%include ‘aaa-memberships-blog’ %}
{% if aaa_hide_item == true %}
{%include aaa_noaccess_snippet %}
{% break %}
{% endif %}
{% else %}
{% break %}
{% endif %}
{%endif%}
{% if aaa_mem_helper == ‘search’ %}
{% assign product = item %}
{%include ‘aaa-memberships-product’ %}
{% if aaa_hide_item == true %}
{% continue %}
{% endif %}
{%endif%}
(e) Save it.
Step 4. Repeat step 3(a to e) for each missing snippet.
NOTE
After adding all the snippets in a new theme, proceed for the liquid installation. CLICK HERE for guidance.