• You have created Products in the Admin

Getting Started

This Tutorial will show you how to output a list of Products on your site.

It will cover how to:

  • Find where Product layouts are stored on Code Editor
  • Develop a wrapper.liquid file
  • Develop an item.liquid file

Add a List of Products to a Site

{%- include 'ecommerce/products', layout: "products", category_ids: current_category_id, type: 'list' -%}


  • layout - choose the layout file for this list.
  • category_ids - filter the List by these category ids
  • sort_type  - the field you wish the sort by
  • sort_order - 'asc' or 'desc' - the order you wish to sort by.
  • use_search - See
  • type - Should be list, for a List View layout. This can also be used to display different types of layouts, like a Cart in a different context. 

Folder Structure

In SITE MANAGER/Code Editor, the folder structure for eCommerce layouts is as below:


Creating a new set of Product Layouts

To create a new set of Product layouts- create your folder at the level of "name_of_my_layout". Inside that, the folders and files should be created as shown above.

List Layout Development

A list view for products is made up of two parts.


wrapper.liquid -- list view example

<div class="row">
  <div class="card-deck"> {%- include 'modules/siteglide_ecommerce/ecommerce/get/get_products', item_layout: 'item' -%}

The wrapper contains the code for the main part of the section you are building. For example, the section title or some margin or padding that separates your list from other sections.

In the wrapper.liquid file, it is important to include the liquid file which loops over the Product items:

{%- include 'modules/siteglide_ecommerce/ecommerce/get/get_products', item_layout: 'item' -%}

The item_layout parameter should be the name of a liquid file in the same folder as the current file. Usually this will be "item", but you could have an alternative Layout.


item.liquid -- list view example

<div class="card">
  <div class="card-img">
    <a href="/{{this.module_slug}}/{{this.slug}}">
      <img src="{{this.Image | asset_url}}" alt="{{}}" class="card-img-top">
  <div class="card-body">
    <a style="height: 100%" href="/{{this.module_slug}}/{{this.slug}}">
      <h3 class="card-title">{{this['name']}}</h3>

This file contains the code for each iteration of the loop that displays the Products. You should expect this code to be rendered multiple times; once for each product displayed in the list. (Hint: Try not to run any GraphQL calls inside a loop or item.liquid file, as they would have an impact on performance. It is better to run these inside the wrapper.)

As it is inside the loop, the item.liquid file has access to the "this" object and dynamic information specific to an individual product. A full reference for the fields you can use can be found here or you may find it convenient to output the "this" object on the page you are developing:

Output all data available in the "this" object.

{{this | json}}

Adding to Cart

Supported Features

Adding Products from a List View to the Cart is only partially supported. We're working on increasing the support to cover more use-cases.

What we do support on the List View:

  • Adding one of each Product at a time

What we will support soon:

  • Choosing the Quantity
  • Choosing Attributes

How to Add to Cart from the List Layout

As with Detail Layouts, you'll need to include the "Add to Cart" button. 

{% include 'ecommerce/cart_add' -%}

As we only support adding a quantity of 1 of each Product at a time from the List View, you'll need to hardcode the quantity selector to have a value of 1 and a readonly attribute. You may also choose to hide this control from the User, with the hidden attribute. 

<input readonly hidden type="number" min="1" value="1"  data-quantity-control id="quantity" /> 

Related Docs and Reference

See the Product Layout Reference Doc for fields you can use throughout your Product Layouts.

Did this answer your question?