Skip to main content

How to Exclude Tagged Products from Klaviyo Abandoned Checkout Emails

  • May 22, 2026
  • 0 replies
  • 8 views

Claudia Howard
Contributor II
Forum|alt.badge.img+4

I previously used custom code inside a text block to exclude tagged products in Shopify from Abandoned Checkout flows (thanks to Joseph Hsieh for the original inspiration).

I’m now using Klaviyo’s newer HTML block for the same functionality.

I wanted to preserve:

  • excluding tagged products in Shopify from Abandoned Checkout emails
  • skipping the email if a product sells out before the first email sends
  • inheriting the template’s global style

Here’s the code to copy into the HTML block:
 

<div style="padding:20px;">

  {% for item in event.extra.line_items %}

    {% if not 'ac_exclude' in item.product.tags %}

      {% catalog item.product_id unpublished="cancel" %}

        <div style="padding:20px 40px;">

          <div style="text-align:center; margin:0 0 15px 0;">
            <a href="{{ event.extra.responsive_checkout_url }}">
              <img
                style="width:300px; max-width:100%; display:block; margin:0 auto;"
                src="{% if item.product.variant.images.0.src %}{{ item.product.variant.images.0.src }}{% else %}{{ item.product.images.0.src|missing_product_image }}{% endif %}"
                width="300"
                alt="{{ item.product.title }}"
              >
            </a>
          </div>

          <div style="text-align:center;">
            <p style="margin:0;">
              <a
                href="{{ organization.url }}/products/{{ item.product.handle }}"
                style="text-decoration:underline;"
              >
                {{ item.product.title }}
              </a>
            </p>
          </div>

        </div>

      {% endcatalog %}

    {% endif %}

  {% endfor %}

</div>