List stores

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

List stores from external ids stored in a contact custom field

A contact can have its favorite stores stored in a custom field and you can list them with the following Liquid syntax

{% create_stores_list favorite_stores = contact.custom_fields['favorite_stores'] %}
{% for store in favorite_stores %}
	<p>
		Name: {{ store.name }}<br>
		City: {{ store.custom_fields['city'] }}<br>
	</p>
{% endfor %}

List stores from external ids given on the design

Sometimes, you need to list stores from specific external ids

{% create_stores_list france_stores = ["extid_01", "extid_02", "extid_O3"] %}
{% for store in france_stores %}
	<p>
		Name: {{ store.name }}<br>
		City: {{ store.custom_fields['city'] }}<br>
	</p>
{% endfor %}

List all stores

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

{% assign nbStoreFound = 0 %}
{% for store in stores %}
	{% if store.custom_fields['country'] == "FR" %}
  	{% assign nbStoreFound = nbStoreFound + 1 %}
<p>
		Name: {{ store.name }}<br>
		City: {{ store.custom_fields['city'] }}<br>
</p>
   {% endif %}
   {% if nbStoreFound >= 3 %}
   		{% break %}
   {% endif %}
{% endfor %}

this use case list 100 last updated stores and for each of them, it show information only if the store comes from France. After found 3 stores, the iteration is stopped.

List stores from a filter

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

{% stores_filter stores_from_filter = 27 %}
{% for store in stores_from_filter limit: 1 %}
<p>
	Name : {{ store.name }}<br>
	City : {{ store.custom_fields['city'] }}<br>
	Type : {{ store.type }}<br> 
</p>
{% endfor %}

This use case will display 1 store that is in the filter 27. 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