Hello!
So I’m having some issues while making a custom feature - I’m trying to make swatches in just the product page (since I’m using bundles, so cannot use the variant option), and what I’m doing is I have made a product metafield and the same products w different colors have the same metafield value.
Only the top 50 products are working perfectly but after that they don not come, even if i print only the 1st 50 comes, I’ve tried to reorder and it works only whichever is the top 50.
Here’s my code:
{%- assign group_value = product.metafields.custom.color_group_family.value -%}
{%- if group_value -%}
<p class="swatch-label" style="margin-bottom: 0.5rem; font-weight: 500;">Explore shades:</p>
<div class="product-color-swatches">
{%- for prod in collections['color-groups-testdev'].all_products limit: 200 -%}
{% assign downed_meta_value = prod.metafields.custom.color_group_family | strip | downcase %}
{% assign downed_group_value = group_value | strip | downcase %}
{%- if downed_meta_value == downed_group_value -%}
<a
href="{{ prod.url }}"
class="tan-swatch {% if prod.handle == product.handle %}active-swatch{% endif %}"
title="{{ prod.title }}"
data-color-group="{{ prod.metafields.custom.color_group_family.value }}"
>
<img
src="{{ prod.featured_image | img_url: '100x100' }}"
alt="{{ prod.title }}"
>
</a>
{%- endif -%}
{%- endfor -%}
</div>
{%- endif -%}