如何使用Liquid(Shopify)遍历商店的所有产品? [英] How do I loop through all the products of a store using Liquid (Shopify)?

查看:137
本文介绍了如何使用Liquid(Shopify)遍历商店的所有产品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能.我知道.

对于页面上可以循环浏览的产品数量,Shopify施加了限制.

Shopify imposes a limit when it comes to the number of products one can loop through on a page.

当前限制为50.

实际上,这不是真的.

一个人可以使用液体循环浏览商店的所有产品:

One can loop through all the products of a store using liquid :

{% paginate collections["all-products"].products by 10000 %}

  {% for product in collections["all-products"].products %}

     {% comment %}looping through all 10000 products{% endcomment %}

  {% endfor %}

{% endpaginate %}

在上面的示例中,如果一家商店拥有多达10000种产品,那么我可以遍历所有10000种产品.增加分页的数量将相应增加我可以循环浏览的产品的数量.

In the above example, if a store has up to 10000 products I can loop through all 10000 of them. Increasing that pagination number will increase the number of products I can loop through accordingly.

我想知道的是Shopify是否会继续支持这一点(即使他们不喜欢它),因此,我是否可以使用上述内容来建立商店而没有 {%分页收藏集的风险["all-products"].products by 9999999%} 在某个时候被弃用.

What I want to know is whether Shopify will continue to support this (even though they don't like it) and therefore, whether I can build stores using the above without the risk of the {% paginate collections["all-products"].products by 9999999 %} becoming deprecated at some point.

话虽如此,我显然永远不会遍历10000个产品,更不用说其中的99999999个了.但是我绝对想建立一个商店,例如,我将一次浏览500多种产品.

Having said that, I would obviously never loop through 10000 products, let alone 9999999 of them. But I definitely want to build stores where I will be looping through more that 500 products in one go for example.

推荐答案

分页的最大限制为1000.此外,它要么停止在1000,要么出现液体错误.我之前也遇到过同样的问题.

pagination limit is maxed out at 1000. Beyond that it'll either stop at 1000 or give a liquid error. I have had the same issue earlier.

这篇关于如何使用Liquid(Shopify)遍历商店的所有产品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆