List stores

list stores from external ids stored in a contact custom field

contact can have 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

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

{% 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 foreach of them, it show informations only if the store comes from France. After found 3 stores, the iteration is stopped.