Skip to main content
starfox221
Contributor III
Contributor III
May 22, 2024
Solved

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

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.

    This topic has been closed for replies.
    Taylor Tarpley
    Community Manager
    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 

    2 replies

    Taylor Tarpley
    Community Manager
    Community Manager
    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 

    starfox221
    Contributor III
    Contributor III
    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.