Ad

Shopify Liquid Product.thumbnail.liquid Repeats Block Even There Is No Loops

- 1 answer

[![enter image description here][1]][1]My job Is too simple i.e just to add Amazon url in a div block in product thumbnail.liquid.I Have added just simple div, then I found that same div is repeated twice. I have also checked that there is no forloop found still how does it is repeating .Today I found the file called product-loop.liquid which has for loop and product thumbnail.liquid is included. What I need to do if I need to show amazon link block only once? Entire file is in gist link.Thanks.

product-loop.liquid

{% assign product_found = false %}
{% assign skip = false %}
{% assign collection_group = products | map: 'id' %}
{% assign collection_group_thumb = collection_group | append : 'thumb' %}
{% assign collection_group_mobile = collection_group | append : 'mobile' %}

{% capture new_row %}
    <br class="clear product_clear" />
{% endcapture %}

<div itemtype="http://schema.org/ItemList" class="products">
  {% for product in products limit: limit %}
    {% if product.id == skip_product.id or skip == true %}
      {% assign product_found = true %}
    {% else %}
      {% if forloop.rindex0 == 0 and product_found == false and forloop.length != products.count and template != 'search' %}
        {% assign skip = true %}
      {% else %}

        {% include 'product-thumbnail', sidebar: sidebar %}

        {% if products_per_row == 2 %}
          {% cycle collection_group: '', new_row %}
        {% elsif products_per_row == 3 %}
          {% cycle collection_group: '', '', new_row %}    
        {% elsif products_per_row == 4 %}  
          {% cycle collection_group: '', '', '', new_row %}
        {% endif %}
      {% endif %}    
    {% endif %}
  {% endfor %}
</div>
Ad

Answer

may be you including product.thumbnail in a section and that section have loop or conditional logics.

Ad
source: stackoverflow.com
Ad