Splio gives you a tool, in the form of transactional loops, to present data directly connected not to a contact, but to a order or an abandoned shopping cart. The syntax you will find in this article is to be used in the HTML Editor. For more details on how to insert this syntax in Message Builder, you can refer to this section of our documentation.
To learn more about loops you can use in campaigns targeting your contacts, see the article about products and stores loops.
Filters
Transactional loops can be used in the campaigns which use orders and abandoned carts filters for targeting. These can be trigger campaigns, sent out whenever a new order or abandoned cart is added to the database.
In the example above, these filters organized by tabs.
When creating such filters, make sure to select one of these two scopes:
In all the examples shown below, you must use a order (or abandoned cart) filter as the population of your campaign for the syntax to work.
Order loops
Use the ORDER keyword to refer to orders (that is, orders which have been placed and paid). Such a loop is processed once for every product found on the order.
<h3>Order ID:$order.extid$</h3>
{SPLIO FOREACH PRODUCT IN ORDER}
<h3>Product ID: $product.sku$</h3>
<p>
Name: $product.name$ ($product.brand$) <br/>
Price: $product.price$
</p>
<img src="$product.img_url$" />
{SPLIO ENDFOREACH}
Explanation:
- Splio goes over the loop once for every product in the current order (that is, line in order).
- Each time it goes through the loop, data from the product fields (name, brand, price, image) is added to the current message.
- You can add any field of the order outside of the loop as shown in the example with the order ID (first line).
Exclude items from an order (order) loop
Use case: You need to make sure that when you display all items found on a order, you never show certain products (e.g., made by a competitor or belonging to a certain group).
{SPLIO FOREACH PRODUCT IN ORDER LIMIT="4"}
{SPLIO IF $product.extid$ != "987153" AND $product.extid$ != "777787" AND
$product.extid$ != "777781" AND $product.extid$ != "227526" AND
$product.ProductType$ != "box"}
<h3>Product ID: $product.sku$</h3>
<p>
Name: $product.name$ ($product.brand$) <br/>
Price: $product.price$
</p>
<img src="$product.img_url$" />
{SPLIO ENDIF}
{SPLIO ENDFOREACH}
Explanation:
The instructions to display a product image and its name are enclosed not only in a loop but also between “{SPLIO IF}” and “{SPLIO ENDIF}”. Whenever the external ID of the product (“”) equals 987153, 777787, 777781, or 227526, or if the product type (“”) is “box”, Splio will not display them. (Because all the negative conditions must be met to display the product.)
Basket loops
You can refer to abandoned carts using the BASKET keyword. This creates a loop that is then processed once for each product that has been placed in the current abandoned cart.
<table>
<tr>
{SPLIO FOREACH PRODUCT IN BASKET SEPARATOR="</tr><tr>" EVERY="3"}
<td>
<h3>Product ID: $product.sku$</h3>
<p>
Name: $product.name$ ($product.brand$) <br/>
Price: $product.price$
</p>
{SPLIO IF $product.img_url$ !=""}
<img src="$product.img_url$" />
{SPLIO ELSE}
[no image display]
{SPLIO ENDIF}
</td>
{SPLIO ENDFOREACH}
</tr>
<tr>
<td>$basket.total_price$</td>
</tr>
</table>
Explanation:
- Splio processes the loop once for every product (item) in the current basket (abandoned cart).
- Each item becomes a table cell, and every 3 cells are gathered into a table row.
- The name, brand, and price data are written into the cell, and a product image is added too.
- Once all products have been displayed, the total value of products in the cart is written below in a separate row.
Please note that when uploading your product prices, you must enter two decimals after the dot (i.e 10.99).
For ready-to-use transactional loops, go to the Intro & Tutorial section > Ready to use blocks & loops > transactional loop.