Skip to main content
Solved

Showing only items that have certain words in Product Title for Abandon Cart Emails


Forum|alt.badge.img+3

Struggling here. I want to show only products that contain “Tires” in the title for the product in the email, as it’s for a specific item

The problem is that right now it is showing multiple other items they added, not just that item

I have a filter within the table for the text on the side: (the success is a placeholder)

{% if 'Tires' in event.ItemNames %}
<div>Success</div>
{% endif %}

But it seems to be working off on complete match, not partial match as the title contains more than just Tires

 

How can I get it to only show items that have Tires in the name, and only show one item? I can’t slice this to just show the first item as it will most likely be a different item in the way the data comes over.

Best answer by Taylor Tarpley

Hi there! 

 

Thanks for sharing your question with us! 

 

I would try a slightly different code to see if this will work with a Title that contains more than just ‘Tires’!

{% if 'tires' in item.product.title %}

 

Additionally, one of our Community Champion’s @Omar shares how to only show a certain number of products in an email in this insightful thread below! 

 

Hope this helps!

-Taylor 

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Taylor Tarpley
Community Manager
Forum|alt.badge.img+60
  • Community Manager
  • 2148 replies
  • Answer
  • May 28, 2024

Hi there! 

 

Thanks for sharing your question with us! 

 

I would try a slightly different code to see if this will work with a Title that contains more than just ‘Tires’!

{% if 'tires' in item.product.title %}

 

Additionally, one of our Community Champion’s @Omar shares how to only show a certain number of products in an email in this insightful thread below! 

 

Hope this helps!

-Taylor 


Forum|alt.badge.img+3
  • Author
  • Problem Solver I
  • 4 replies
  • June 5, 2024

Hi @Taylor Tarpley this still didn’t seem to quite work. I’m on Magento 2 as well, so think the structure is slightly different.