Skip to main content
All CollectionsMembership V1
Set Up The Membership Module Again After Changing The Theme
Set Up The Membership Module Again After Changing The Theme
Updated over 2 weeks ago

For Membership module 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 to setup the Membership Module Again After Changing The Theme-:

Step 1: Go to Online store > Themes > Click Actions and duplicate your theme for backup.

Step 2. Search for aaa snippets, 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.

Account page code:

<div class="aaa-success-msg-account"></div><div class="aaa-error-msg-account"></div><div class="aaa_customer_all_plan_listing" data-customer-email="{{ customer.email }}" data-customer-id="{{ customer.id }}"> </div> <script> function isMyMembershipScriptLoaded() { var url = 'https://shopifycdn.aaawebstore.com/membership/appfiles/aaa_membership_script_min_v3.js?shop=pjknoxxx.myshopify.com'; var jsFound = 0; var scripts = document.getElementsByTagName('script');  for (var i = scripts.length; i--;) { if (scripts[i].src == url) { jsFound = 1; } } if(!jsFound) { var headTag = document.getElementsByTagName('head')[0]; var jqTag = document.createElement('script'); jqTag.type = 'text/javascript'; jqTag.src = url; jqTag.onload = ''; headTag.appendChild(jqTag); } } isMyMembershipScriptLoaded(); </script>

Dawn theme membership code:

{% if template == 'blog' %}

{% include 'aaa_mem_helper' with 'blog' %}

{% endif %}

{% if template == 'collection' %}

{% include 'aaa_mem_helper' with 'collection' %}

{% endif %}

{% if template == "page" %}

{% include 'aaa_mem_helper' with 'page' %}

{% endif %}

{% if template == "product" %}

{% include 'aaa-product-page-filter' %}

{% endif %}

{% if template == "cart" %}

<script> function isMyMembershipScriptLoaded() { var url = 'https://shopifycdn.aaawebstore.com/membership/appfiles/aaa_membership_script_min_v3.js?shop=pjknoxxx.myshopify.com'; var jsFound = 0; var scripts = document.getElementsByTagName('script'); for (var i = scripts.length; i--;) { if (scripts[i].src == url) { jsFound = 1; } } if(!jsFound) { var headTag = document.getElementsByTagName('head')[0]; var jqTag = document.createElement('script'); jqTag.type = 'text/javascript'; jqTag.src = url; jqTag.onload = ''; headTag.appendChild(jqTag); } } isMyMembershipScriptLoaded(); </script><script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>

function aaanewcartmethod() {}

(function($) {

$(document).on("submit", "#cart, form[action='/cart']", function() {

var aaashopurl = "pjknoxxx.myshopify.com";

var aaamembershipurl = "https://membership.aaawebstore.com/";

var note = $("textarea[name=note]").val();

if(note != undefined && note != null){

$.ajax({

url: '/cart/update.js',

type: 'POST',

data: {note: note},

success: function(result) {

//console.log('cart note = '+result);

},

error: function(jqxhr, status, exception) {

console.log(exception);

}

});

}

$.ajax({

url: "/cart.js",

dataType: "json",

success: function (cart) {

if (cart.items.length) {

var cusId = $("#aaamembership_customer_logged_id").val();

var ajax_url = aaamembershipurl + "memberAjaxFormSubmit.php";

var dataform = { formAction: "generateDraftOrder", customer_id: cusId, domain: aaashopurl, cart: cart };

console.log(dataform);

jQuery.ajax({

crossDomain: !0,

url: ajax_url,

method: "POST",

dataType: "json",

data: dataform,

success: function (response) {

if (response.status == "success") {

window.location.href = response.redirecturl;

} else {

window.location.href = "https://"+aaashopurl+"/cart/checkout";

}

}

});

} else {

location.reload();

}

}

});

return false;

});

})(jQuery);

</script>

{% endif %}

Ajaxify cart page :

<script> function isMyMembershipScriptLoaded() { var url = 'https://shopifycdn.aaawebstore.com/membership/appfiles/aaa_membership_script_min_v3.js?shop=pjknoxxx.myshopify.com'; var jsFound = 0; var scripts = document.getElementsByTagName('script');  for (var i = scripts.length; i--;) { if (scripts[i].src == url) { jsFound = 1; } } if(!jsFound) { var headTag = document.getElementsByTagName('head')[0]; var jqTag = document.createElement('script'); jqTag.type = 'text/javascript'; jqTag.src = url; jqTag.onload = ''; headTag.appendChild(jqTag); } } isMyMembershipScriptLoaded(); </script><script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>

function aaanewcartmethod() {}

(function($) {

$(document).on("submit", "form[action='/cart']", function (event) {

var aaashopurl = "pjknoxxx.myshopify.com";

var aaamembershipurl = "https://membership.aaawebstore.com/";

$.ajax({

url: "/cart.js",

dataType: "json",

success: function (cart) {

if (cart.items.length) {

var cusId = $("#aaamembership_customer_logged_id").val();

var ajax_url = aaamembershipurl + "memberAjaxFormSubmit.php";

var dataform = { formAction: "generateDraftOrder", customer_id: cusId, domain: aaashopurl, cart: cart };

console.log(dataform);

jQuery.ajax({

crossDomain: !0,

url: ajax_url,

method: "POST",

dataType: "json",

data: dataform,

success: function (response) {

if (response.status == "success") {

window.location.href = response.redirecturl;

} else {

window.location.href = "https://"+aaashopurl+"/cart/checkout";

}

}

});

} else {

location.reload();

}

}

});

return false;

});

})(jQuery);

</script>

  • Add into the theme.liquid at the end of the <body> tag

{% if customer %}<div class="aaa_customer_id" hidden> {{ customer.id }}</div>{% endif %}<input type="hidden" id="656565115116111114101" data-customer-id="{{ customer.id }}" data-customer-email="{{ customer.email }}" data-customer-name="{{ customer.first_name }} {{ customer.last_name }}"/><input type="hidden" name="aaamembership_customer_logged_id" value="{{customer.id}}" id="aaamembership_customer_logged_id">
  • Add into theme.liquid at the end of the <head> tag

<script> if (typeof jQuery == "undefined") { var headTag = document.getElementsByTagName("head")[0]; var jqTag = document.createElement("script"); jqTag.type = "text/javascript"; jqTag.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; jqTag.onload = ""; headTag.prepend(jqTag) }</script><script src="//staticxx.s3.amazonaws.com/aio_stats_lib_v1.min.js?v=1.0"></script>

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 %}
{% assign aaa_rule_first = aaa_rule.first | downcase | strip %}
{% assign newcustomer_tag = customer_tag | downcase | strip %}
{% if newcustomer_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-collection.liquid

{% comment %}This snippet is generated and updated by aaa Memberships.{% endcomment %}

{% assign aaa_hide_item = false %}

{% assign aaa_item_type = 'blog'%}

{% for aaa_rule in blog.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 blog.metafields.aaa_mem %}

{% for customer_tag in customer.tags %}

{% assign aaa_rule_first = aaa_rule.first | downcase | strip %}

{% assign newcustomer_tag = customer_tag | downcase | strip %}

{% if newcustomer_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-noaccess.liquid

<div class="page-width" style="text-align:center;">
<p style="text-align: center;padding:40px;"> 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 %}
{% assign d_customer_tag = customer_tag | downcase | strip %}
{% assign d_aaa_rule_first = aaa_rule.first | downcase | strip %}
{% if d_customer_tag == d_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 %}
{% assign aaa_rule_first = aaa_rule.first | downcase | strip %}
{% assign newcustomer_tag = customer_tag | downcase | strip %}
{% if newcustomer_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 %}
{% assign aaa_rule_first = aaa_rule.first | downcase | strip %}
{% assign newcustomer_tag = customer_tag | downcase | strip %}
{% if newcustomer_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-memberships-noaccess' %}
{% 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-memberships-noaccess' %}
{% 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-memberships-noaccess' %}
{% 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-memberships-noaccess' %}
{% 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-memberships-noaccess' %}
{% 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%}

aaa-memberships-article.liquid

{% comment %}This snippet is generated and updated by aaa Memberships.{% endcomment %}
{% assign aaa_hide_item = false %}

{% assign aaa_item_type = 'blog'%}

{% for aaa_rule in blog.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 blog.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_membership.liquid

{% if template == 'blog' %}
{% include 'aaa_mem_helper' with 'blog' %}
{% endif %}
{% if template == 'article' %}
{% include 'aaa_mem_helper' with 'blog' %}
{% endif %}
{% if template == 'collection' %}
{% include 'aaa_mem_helper' with 'collection' %}
{% endif %}
{% if template contains "page" %}
{% include 'aaa_mem_helper' with 'page' %}
{% endif %}
{% if template == "product" %}
{% include 'aaa-product-page-filter' %}
{% endif %}


—-----------------------aaaa-setup—-----------
{% if template contains 'page' %}
{% include 'aaa_mem_helper' with 'page' %}
{% endif %}
{% if template contains 'blog' or template contains 'article' %}
{% include 'aaa_mem_helper' with 'blog' %}
{% endif %}
{% if template contains 'collection' %}
{% include 'aaa_mem_helper' with 'collection' %}
{% endif %}
{{ content_for_layout }}

Note:

After adding all the snippets in a new theme, proceed for the liquid installation. CLICK HERE for guidance.


Did this answer your question?