Often times you might not want to show FAQs on all collections or all product pages. In those cases, following code snippets might come handy.


Use case # 1 : You would like to show FAQs only on certain collection page.


You can show FAQs only on certain collection with the help of following liquid code. This code goes in your collection.liquid.


{% if collection.handle == "wines" %}
// Put embed code of FAQs you would like to show on wines collection
{%- endif -%}

{% if collection.handle == "beer" %}
// Put embed code of FAQs you would like to show on beer collection
{%- endif -%}


Use case #2 : You would like to show FAQs only on products which belong to certain collection.


Note that one product can belong to multiple shopify collections and we are only looking for first collection in example below. Replace "new" with your collection handle.


{% assign product_collection = product.collections.first %}
{% if product_collection and product_collection.handle  == 'new' %}
// Put embed code for FAQs you would like to show on new collection
{% endif %}


If you would like to be little flexible and check all collections product belongs then following liquid code would come handy.


{% assign product_collection = product.collections %}
{% if product_collection %}
{% for collection in product_collection %}
{% if collection.handle == 'two' %}
// Put embed code for FAQs which you would like to show when product belongs to collection two.
{% endif %}
{% endfor %}
{% endif %}


Use case # 3: Show FAQs on cart page only when particular product is in cart. You would need to replace ID with product ID you are looking for.


{% for item in cart.items %}
{% if item.product.id == 4951626317956 %}
// put FAQs Embed code here
{% endif %}
{% endfor %}