Products missing in certain collections and not others

New Member
3 0 0

Hi I am trying to create swatches that are clickable and will redirect to the correct product. My code works except for two collections. One does not show anything and the other shows nothing. Which is weird because the other collections work as intended.

 

Here is an image of what I am trying to achieve:

Screen Shot 2019-12-05 at 3.47.54 PM.png

 

 

 

 

 

 

 

 

 

and here is my code:

 

 

{% assign swatch_products = collection.products | where: "type", product.type %}

<ul style="display: flex; flex-direction: row; flex-wrap: wrap; margin: 20px 0;">
{% for product in swatch_products %}
    <a href="{{product.url | within: collection }}">
       <li style="width: 50px; height: 50px; margin: 0 10px 10px;">
         <img src="{{ product.featured_image | img_url: "50x50"}}" alt="{{ image.alt }}" width="50px" height="50px" >
        </li>
     </a>
{% endfor %}
</ul>

 

Any help I can get would be greatly appreciated!

0 Likes
New Member
3 0 0

I was able to figure out one reason as to why. It seems when the collection goes over 50 products any item clicked after the 50th product within that collection will not appear.

0 Likes