[Shopify iterate over more than 50 - all collection items] Shopify has a limit to only give 50 items back per collection. So we have to offset the loops till we got all items. #shopify #liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign handles = linklists.blogs.links | map:'object' | map:'handle' %} | |
{% for handle in handles %} | |
{% assign blog = blogs[handle] %} | |
{% for article in blog.articles | offset:0 %} | |
{text:"{{ article.title | escape }}", url:"{{ shop.url }}/{{handle}}/{{ article.handle }}"}, | |
{% endfor %} | |
{% for article in blog.articles | offset:50 %} | |
{text:"{{ article.title | escape }}", url:"{{ shop.url }}/{{handle}}/{{ article.handle }}"}, | |
{% endfor %} | |
{% for article in blog.articles | offset:100 %} | |
{text:"{{ article.title | escape }}", url:"{{ shop.url }}/{{handle}}/{{ article.handle }}"}, | |
{% endfor %} | |
{% for article in blog.articles | offset:150 %} | |
{text:"{{ article.title | escape }}", url:"{{ shop.url }}/{{handle}}/{{ article.handle }}"}, | |
{% endfor %} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for product in collections.all.products | offset:0 %} | |
{text:"{{ product.title | escape }}", url:"{{ shop.url }}/products/{{ product.handle }}"}, | |
{% endfor %} | |
{% for product in collections.all.products | offset:50 %} | |
{text:"{{ product.title | escape }}", url:"{{ shop.url }}/products/{{ product.handle }}"}, | |
{% endfor %} | |
{% for product in collections.all.products | offset:100 %} | |
{text:"{{ product.title | escape }}", url:"{{ shop.url }}/products/{{ product.handle }}"}, | |
{% endfor %} | |
{% for product in collections.all.products | offset:150 %} | |
{text:"{{ product.title | escape }}", url:"{{ shop.url }}/products/{{ product.handle }}"}, | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With offset it is doesen wort anymore.