Hi @KenH
One other option, which does come with some drawbacks, is to add the Catalog lookup tag to the dynamic block in your email.
{% catalog item.product_id unpublished="cancel" %} <a href="{{ event.extra.responsive_checkout_url }}"> <img src="{{ catalog_item.featured_image.thumbnail.src }}" alt="" width=""></a> {% endcatalog %}</div>
{% endif %}
Similar to you, I had a client that would have items go out of stock quickly and they were having customers frustrated by receiving emails for the items that had already gone out of stock.
The Catalog lookup references the product data sync’d from your ecommerce integration in Klaviyo and in this case, looks at the status of the product ID to see if the product is published or not. If the product is unpublished, this code will essentially block the email from being sent.
A couple of things to note:
- You do need to code your dynamic product block image using the code above (+ any adjustments you might want (ie. image size, etc.) The code above also hyperlinks the image to the cart. If you don’t want to do that, you’d need to remove the <a href> tag. (But, I always recommend linking your images in the cart abandon)
- If you use this… even if one item in the checkout email is out of stock, but there are other items in the cart that are still in-stock, this will block the email altogether.
This second point should be the biggest consideration for weighing this approach.
Now, one thing you could consider, but this will be dependent on how many products you sell and how many go out of stock, but you could also use the following to simply hide a product from the cart abandon email. Transparently, I have not done this, but as I was thinking about your use case, it could potentially work and it could offset the second bullet above.
But, the draw back is you would have to manage and update this code per item (or maybe we collection) to hide the item from the dynamic product block.
{% if item.product.title != 'PRODUCT NAME' %}
YOUR PRODUCT INFO & HTML
{% endif %}
You would use this {% IF %} tag which essential “says” if product.title doesn’t equal PRODUCT NAME, then show this block. You would need to add this to both the image and text side of your product block. And, the Image would need to be coded using a text block and HTML to show the actual image vs. an image block.
Just a couple more options to consider.
I hope this helps!
@In the Inbox