Skip to content

Commit

Permalink
Update from Shopify for theme sneakerlab/trunk
Browse files Browse the repository at this point in the history
Committed from shop: Sneaker Lab 2022
  • Loading branch information
shopify[bot] committed Aug 27, 2024
1 parent 8ba6e1c commit 6ef56dc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions snippets/shogun-products.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,25 @@ This file can be re-written at any time.
};
</script>
{% endif %}

{%- assign collections_meta = content.metafields.shogun.collections.value -%}
{%- if collections_meta.size > 0 -%}
<script type="text/javascript">
window.__shgProducts = window.__shgProducts || {};
window.__shgCategories = window.__shgCategories || {};
{%- for collection_meta in collections_meta %}
{%- assign collection = collections[collection_meta.handle] -%}
window.__shgCategories["{{collection.handle}}"] = window.__shgCategories["{{collection.handle}}"] || {{ collection | json }};
window.__shgCategories["{{collection.handle}}"].products = window.__shgCategories["{{collection.handle}}"].products || [];
{%- paginate collection.products by collection_meta.count -%}
{%- for product in collection.products %}
window.__shgProducts["{{product.handle}}"] = window.__shgProducts["{{product.handle}}"] || {{ product | json }};
if (!window.__shgCategories["{{collection.handle}}"].products.find(product => product.id == {{ product.id }})) {
window.__shgCategories["{{collection.handle}}"].products.push(window.__shgProducts["{{product.handle}}"]);
};
{%- endfor -%}
{%- endpaginate -%}
{%- endfor %}
</script>
{%- endif -%}

0 comments on commit 6ef56dc

Please sign in to comment.