Inserting Multiple Products Into An Email Template
Swish sends events when a users interacts with their Wishlist, including when a users adds to, removes from or views their Wishlist.
These behavioural events can be used to trigger emails that feature multiple products from a customers Wishlist such as Wishlist Welcome and Reminder flows.
The method explained below needs to utilise our LatestWishlistItems
event, which can contain up to 10 of the most recent wishlisted products in a customer's Wishlist.
The simplest way to insert product information from a Wishlist event is by using a Table content block in your email templates.
To add a Table content block and integrate the catalog lookup tags for displaying your products and content, follow these steps:
Under Blocks select and drag a Table onto your template where you would like your product image and details to appear.

Tables utilise Static data within the Styles setting by default. For emails that feature multiple products from an event, the data should be set to Dynamic.
The following code should be added to the Row collection field.
Note: the slice
value determines the amount of products that will be shown in the email. (10 max.)
event.LatestWishlistItems|slice:10
The Row Alias should be set to "item
".
Delete the second column.

Now, to insert product details we ensure the Cell content is set to Text and open the </> code editor.

Here you can utilise the relevant catalog lookup tags from the table above. In this example we are going to include the Product title, variant title and current price using the following code:
NOTE: This code must be pasted into the Source code within the text editor:
Once you have the Source Code editor open, paste the below code
<p style="text-align: center;">
<a href="{% catalog item.ItemId integration='shopify' %}{{ catalog_item.url }}{% endcatalog %}">
<img src="{% catalog item.ItemId integration='shopify' %}{{ catalog_item.featured_image.full.src }}{% endcatalog %}">
</a>
</p>
<p style="text-align: center;">
<a href="{% catalog item.ItemId integration='shopify' %}{{ catalog_item.url }}{% endcatalog %}">{% catalog item.ItemId integration='shopify' %}{{ catalog_item.title }}{% endcatalog %}</a>
</p>
<p style="text-align: center;">
{% catalog item.ItemId integration='shopify' %}
{% if catalog_item.variant %}
<!-- Single variant product or user has select variant -->
{% currency_format catalog_item.variant.price %}
{% if catalog_item.variant.metadata|lookup:"compare_at_price" and catalog_item.variant.metadata|lookup:"compare_at_price"|divide:1 > catalog_item.variant.price|divide:1 %}
<s>{% currency_format catalog_item.variant.metadata|lookup:"compare_at_price" %}</s>
{% elif catalog_item.metadata|lookup:"compare_at_price" and catalog_item.metadata|lookup:"compare_at_price"|divide:1 > catalog_item.variant.price|divide:1 %}
<s>{% currency_format catalog_item.metadata|lookup:"compare_at_price" %}</s>
{% endif %}
{% else %}
<!-- Multiple variant product and no variant selected -->
{% currency_format catalog_item.metadata|lookup:"price" %}
{% if catalog_item.metadata|lookup:"compare_at_price" and catalog_item.metadata|lookup:"compare_at_price"|divide:1 > 0 %}
<s>{% currency_format catalog_item.metadata|lookup:"compare_at_price" %}</s>
{% endif %}
{% endif %}
{% endcatalog %}
</p>

You can now preview and send a test email to ensure that everything is setup and working as expected!
Last updated