How do I display all of my products on my home page using Shopify and Liquid?

笑着哭i 提交于 2019-12-08 07:59:30

问题


Is there a simple snippet of Liquid markup I can use on my index.liquid page (home page) to display all of the products that I have and make each of those images a link to the respective product's information page?


回答1:


Most themes display a collection on their home page. Go with that functionality, don't add code.

For your home page collection to include all products in your store, make it a smart collection with a condition such as Product Price > 0.

If you have more than 50 products in your shop, you can add pagination to your home page by adding Liquid tags to your templates/index.liquid file. For inspiration on how pagination is done in a Shopify theme, look into your templates/collection.liquid file.

There is possibly some limit imposed by your theme on how many products from your homepage collection are shown on your home page. If that's the case, you'll find code that looks like this in your templates/index.liquid file:

{% for product in collections.frontpage.products limit: 12 %}

Remove the limit attribute.



来源:https://stackoverflow.com/questions/11960968/how-do-i-display-all-of-my-products-on-my-home-page-using-shopify-and-liquid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!