Skip to main content
Solved

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

  • 22 May 2024
  • 2 replies
  • 40 views

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.

2 replies

Userlevel 7
Badge +60

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 

Badge +3

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.

Reply