Last active
December 23, 2022 17:21
-
-
Save Maybach91/20c1d5a4be1dd245b892b170aee6e91c to your computer and use it in GitHub Desktop.
[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 hidden or 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 hidden or 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.