I’m working on a new email for a Post-purchase workflow and would like to hide and show different modules based on what the customer purchased. I’ve looked into doing this with both the Block Repeat Feature and by writing my own code into my template. The one thing I’m stuck on is how to prevent the system from repeating the module if the customer has 2 or more of the same product in their purchase. For example, if they bought two candles, I want to show the “Candle Care” module 1 time, not twice.
Does anyone know how to do this in the Block Repeat Feature or in custom liquid logic? Here is the liquid that I already tried but didn’t work:
{% for item in event.extra.line_items %} {% if 'Candle' in item.name %} {% firstof "true" as custom_candle_variable %} {% elif 'Book' in item.name %} {% firstof "true" as custom_book_variable %} {% elif 'Trio' in item.name %} {% firstof "true" as custom_trio_variable %} {% endif %}{% endfor %}{% if custom_candle_variable %} <!-- show Candle block here -->{% endif %}{% if custom_book_variable %} <!-- show Book block here -->{% endif %}{% if custom_trio_variable %} <!-- show Trio block here -->{% endif %}