Nested forloop

Boba
Tourist
12 0 1

Hello,

I have a forloop iterating over product.media. I'd like to add a nested forloop and get that product's variant based on the index of the outer loop. Something like this:

{%- for media in product.media -%}
{%- assign i = forloop.index0 -%}
  {%- for variant in product.variants -%}
    {{ variant.title[i] }}
  {% endfor %}
{% endfor %}
0 Likes