Skip to content

Excluding Shipping Protection from Marketing Emails

When you setup abandon cart flows in Klaviyo, you probably don’t want shipping protection to be displayed as the feature items in your messaging. You can easily remove shipping protection with some conditional logic in the email and sms templates

Email

The abandon cart emails will list out all the line items in the cart before the customer abandoned. You can exclude shipping protection from that list with the following block of code.

Text Content

{% if item.product.handle != 'sustainability-coverage' %}
... (your content here)
{% endif %}

Image Content

{% if item.product.handle != 'sustainability-coverage' %}
{% if item.product.variant.images.0.src %}
{{item.product.variant.images.0.src}}
{%else%}
{{item.product.images.0.src|missing_product_image}}
{%endif%}
{%endif%}

SMS

If you are displaying a media image in your sms, you will want to make sure it isn’t the shipping protection image. This piece of code should the dynamic image content

Setting SMS image dynamically screenshot

{% if event.extra.line_items.0.product.handle == 'sustainability-coverage' %}
{{ event.extra.line_items.1.product.images.0.src }}
{% else %}
{{ event.extra.line_items.0.product.images.0.src }}
{% endif %}