如何在 collection 列表中一页显示所有前 1 名产品?

How display all top 1 product on collection list one one page?

我试图在一个页面上显示 collection 上的所有排名前 1 的产品。但我知道怎么做。

我分享上传三个屏幕截图,我希望它们显示在一个页面上。有什么建议吗?

有很多方法可以做到这一点。

1 种方式。首先创建一个带有条件的新集合,select product type 等于 top 1。在您希望出现在该集合中的产品中,将 top 1 添加到类型。

  1. {% for collection in collections %}
     {% for product in collection.products %}
         {% if forloop.index == 1%}
         {% comment %}display product{% endcomment %}
         {% endif %}
     {% endfor %} {% endfor %}
    

以上代码将 select 商店中每个系列的第一个产品。要控制先显示哪个,请转到集合并 select 排序顺序。