How to paginate large collections with tags in Minimal theme?

Hi, i’m trying to write a code that has to show images of related by tag products in my product page.

I’m working on a theme that’s called Minimal !

My biggest problem is the fact that my collections are big and i can’t get all products that i have to compare and see if they have the tag that i am looking for and to show there image on the page.

I’m trying to paginate it, but it that’s the error tha gives me : Liquid error (sections/product-template.liquid line 394): Array ‘collections.all.products’’ is not paginateable.

I tried to change the collection to see if it is from it but it still gives the same mistake.

That’s my code so far:

{% for tag in product.tags %}
{% if tag contains “alt” %}
{% assign myTagForSearching = tag %}
{% unless collections.all.products == blank %}

Other colors:

    {% paginate collections.all.products by limit %}
    {% for productRelated in collections.all.products %}

    {% for tagRelated in productRelated.tags %}

    {% if tagRelated contains myTagForSearching %}

    {% assign productRelatedVariantsIndex = ‘’ %}

    {% for variantRelated in productRelated.variants %}
    {% if variantRelated.available %}
    {% assign productRelatedVariantsIndex = productRelatedVariantsIndex | append: ‘x’ %}
    {% endif %}
    {% endfor %}

    {% if productRelatedVariantsIndex != ‘’ %}

  • {{ productRelated.title }}
  • {% else %}

  • {{ productRelated.title }}
  • {% endif %}

    {% endif %}
    {% break %}
    {% endfor %}

    {% endfor %}
    {% endpaginate %}

{% endunless %} {% break %} {% endif %} {% endfor %}

What i see is you paginate collection products in product-template.liquid

It should be in collection.liquid or something similar.