List products

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

be careful, the list is limited to 100 products ordered by last update date

{% 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 foreach of them, it show informations only if the product is of category shoe and cost more than 100 euros. After found 3 product, the iteration is stopped.