As I'm looping through a collection in Shopify, I want to add that product to another array of products so that I can loop through it again.
{% assign custom_products = '' %}
{% for product in collections['all'].products %}
    {% assign custom_products = custom_products | append: product %}
{% endfor %}
But when I iterate through it again I get nothing
{% for product in custom_products %}
{% endfor %}
When I dump custom_products I get ProductDropProductDropProductDropProductDrop... and so on. Is this because I am constructing as a string? I want the second for loop in the Liquid template to move through the products as if it were collections['all'].products. Any ideas?
{% capture custom_products %}
  {% for product in collections['all'].products %}
    {{ custom_products }},{{ product.handle }}
  {% endfor %}
{% endcapture %}
{% assign custom_products = custom_products | split: ',' %}
{% for product in custom_products %}
  {{ all_products[product].title }}
{% endfor %}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With