List products

All the different possibilites to display a list of products in your email designs with the Liquid syntax !

List products from external ids stored in a contact custom field

Contact can have favorite products stored in a custom field and you can list them with the following Liquid syntax

{% create_products_list favorite_products = contact.custom_fields['favorite_products'] %}
{% for product in favorite_products %}
	<p>
		Name: {{ product.name }}<br>
		Brand: {{ product.brand }}<br>
		Price: {{ product.price }}<br>
	</p>
{% endfor %}

List products from external ids given on the design

Sometimes, you need to list products from specific external ids

{% create_products_list wishlist_products = ["extid_01", "extid_02", "extid_O3"] %}
{% for product in wishlist_products %}
	<p>
		Name: {{ product.name }}<br>
		Brand: {{ product.brand }}<br>
		Price: {{ product.price }}<br>
	</p>
{% endfor %}

List all products

Sometimes, you should want to show a list of products with a specific characteristic. For this you can list all the products, but be careful the list is limited to 100 products ordered by update date (the most recently updated first).

{% assign nbProductFound = 0 %}
{% for product in products %}
	{% if product.category == "shoes" and product.price > 100 %}
  	{% assign nbProductFound = nbProductFound + 1 %}
<p>
		Name: {{ product.name }}<br>
		Brand: {{ product.brand }}<br>
		Price: {{ product.price }}<br>
</p>
   {% endif %}
   {% if nbProductFound >= 3 %}
   		{% break %}
   {% endif %}
{% endfor %}

This use case list 100 last updated products and for each of them, it show information only if the product is of category shoe and cost more than 100 euros. After found 3 product, the iteration is stopped.

List products from a filter

If you have a defined Product filter, you can reuse this filter inside your email design to display only the products that are part of the filter. For this you can list them, but be careful the list is limited to 100 products.

{% products_filter products_from_filter = 50 %}
{% for product in products_from_filter limit: 1 %}
<p>
	Name : {{ product.name }}
	External ID : {{ product.external_id }}
	Description : {{ product.decription }}
</p>
{% endfor %}

This use case will display 1 product that was in the filter 50. The choose which filter you want you must use the ID of the filter.

Where to find the ID of a filter

Where to find the ID of a filter