I am trying to set up a page on my Shopify site that only shows one Collection of products and has no header or footer. I got the header and footer part coded but now when I try to add the Collection part of the code it has messed up the entire page and I can’t save it without getting the following error - Liquid syntax error: ‘for’ tag was never closed.
Here is the code I am using under the Venture 12.5.1 theme.
div#shopify-section-header {display: none;}
{% for product in collections.all.products %}
{% for collection in product.collections %}
{% if collection.title == ‘Atlee Football 2022’ %}
{% paginate collection.products by 20 %}
{{ collection.title }}
{% if current_tags %}
– {% assign title_tags = current_tags | join: ', ' %}
{{ title_tags }}
{% endif %}
{% if collection.description != blank %}
{{ collection.description }}
{% endif %}
{% section 'collection-filters' %}
{% for product in collection.products %}
{% include 'product-card', product: product %}
{% else %}
{% comment %}
Add default products to help with onboarding for collections/all only.
The onboarding styles and products are only loaded if the
store has no products.
{% endcomment %}
{% if shop.products_count == 0 %}
{% assign collection_index = 1 %}
{% for i in (1..10) %}
{% case i %}
{% when 7 %}
{% assign collection_index = 1 %}
{% when 8 %}
{% assign collection_index = 2 %}
{% when 9 %}
{% assign collection_index = 3 %}
{% when 10 %}
{% assign collection_index = 4 %}
{% endcase %}
{% assign collection_index = collection_index | plus: 1 %}
{% endfor %}
div#shopify-section-footer {display: none;}
Hi @NickC63
There are many mistakes in this code (many unclosed tags) but I managed to roughly fix it so you can save it and make modifications to it:
{% for product in collections.all.products %}
{% for collection in product.collections %}
{% if collection.title == 'Atlee Football 2022' %}
{% paginate collection.products by 20 %}
{% for product in collection.products %}
{% include 'product-card', product: product %}
{% else %}
{% comment %}
Add default products to help with onboarding for collections/all only.
The onboarding styles and products are only loaded if the
store has no products.
{% endcomment %}
{% if shop.products_count == 0 %}
{% assign collection_index = 1 %}
{% for i in (1..10) %}
{% case i %}
{% when 7 %}
{% assign collection_index = 1 %}
{% when 8 %}
{% assign collection_index = 2 %}
{% when 9 %}
{% assign collection_index = 3 %}
{% when 10 %}
{% assign collection_index = 4 %}
{% endcase %}
{% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
{{ 'product-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
{{ 'homepage.onboarding.product_title' | t }}
$19.99
{% assign view_string_length = 'products.product.view' | t | size %}
{{ 'products.product.view' | t }}
{% assign collection_index = collection_index | plus: 1 %}
{% endfor %}
{% endif %}
{% endfor %}
{% endpaginate %}
{% endif %}
{% endfor %}
{% endfor %}
Hopefully that helps.
Awesome, thank you! I know nothing about code so I was just copying and pasting things together lol.
I have two more questions for you if you don’t mind!
-
Is there anyway to get the footer to disappear as well? It’s in the code right now and is the same as the code for the header but is still showing on the site.
-
How do I make it so there is no header/footer for the product pages that are a part of that collection?
Thanks again for all your help!
The page also just stopped showing the products completely.
Please copy this code into theme.liquid above the closing tag:
{% if template contains 'product' %}
{% for collection in product.collections %}
{% if collection.handle == 'atlee-football-2022' %}
{% endif %}
{% endfor %}
{% endif %}
Hi, how to i add “metafield” section in the coding part? which want to show New Arrival Tag for the products.
https://www.youtube.com/watch?v=WNaSsbyPD98&ab_channel=ArchetypeThemes