I am currently trying to display prices for all my products in my shopify store. I have managed to show this for my first product using the following code:
<div class="grid__item">
{% for collection in collections %}
{% for product in collection.products %}
{% for variant in product.variants %}
{% if forloop.index <=1 %}
<div id="temp_first" style="display:none;">
<div class="style14">Style</div>
<div class="style11">(No)</div>
<div class="front"><img src="//files/front.jpg?v=1473520767" title="1 Sided Full Color" /></div>
<div class="reverse"><img src="//1/1265/7581/files/reverse.jpg?v=1473520807" title="1 Sided Only" /></div>
<div class="price"><a href="/products/leaflets?variant={{ variant.id }}">{{ variant.price | money | remove: '.00'}}</a></div>
{% elsif forloop.index <7 %}
<div class="price"><a href="/products/leaflets?variant={{ variant.id }}">{{ variant.price | money | remove: '.00'}}</a></div>
{% elsif forloop.index <10 %}
<div class="price2"><a href="/products/leaflets?variant={{ variant.id }}">{{ variant.price | money | remove: '.00'}}</a></div>
{% elsif forloop.index <13 %}
<div class="price3"><a href="/products/leaflets?variant={{ variant.id }}">{{ variant.price | money | remove: '.00'}}</a></div>
{% elsif forloop.index ==13 %}
<div class="price3"><a href="/products/leaflets?variant={{ variant.id }}">{{ variant.price | money | remove: '.00'}}</a></div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
Now that works perfectly fine. The problem I have now is that I would like to display prices for a 2nd product and I duplicated the above code and changed the links in order to link this to the correct product page and variant and this works fine. The issue is the prices that are shown are for the first product and I don't know what I need to change in the code to target the 2nd product. Whether this is by its handle name or what, i'm just not sure, hence the need for some help.
If somebody could please advise, how I could target the 2nd product, would really appreciate it.
Thanks in advance.