Website Building » Shopify » How Do I Get All the Products in Shopify Liquid?

How Do I Get All the Products in Shopify Liquid?

Last updated on October 2, 2022 @ 3:53 am

If you’re running a Shopify store, you’ve probably wondered how to get all the products in your shop onto one page. It’s actually quite easy to do with Shopify’s Liquid templating language.

First, you need to create a new page template. In your Shopify admin, go to Online Store > Themes.

Find the theme you’re currently using, and click the Actions button. From the drop-down menu, select Edit code.

In the Edit HTML/CSS page, look for the Templates folder. Click on it, then click on Add a new template.

In the pop-up window, select page as your template type, and enter collection as the template name. Click Create template.

PRO TIP: If you are not careful, using the wrong Liquid tag could result in your Shopify theme displaying all products on a single page, which can cause major performance issues for your store.

Now that you have a new template, you can start adding Liquid code to it. The first thing you need to do is add a line of code that tells Shopify which collection you want to pull products from. For example, if you want to pull all products from your shop, you would use this code:

{% collection all %}

You can also specify a specific collection by using its handle instead of all. For example, if you have a collection called “Bestsellers,” you would use this code:

{% collection handle ‘bestsellers’ %}

Once you’ve added that line of code, the next thing you need to do is loop through all the products in that collection and output them on the page. You can do that with this code:

{% for product in collection.products %}
{{ product.title }}
{% endfor %}

Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.