Skip to main content
Solved

Any Max Size for email text with huge Conditional {% elif %} for multiple possiblities?

  • February 7, 2025
  • 1 reply
  • 20 views

Forum|alt.badge.img

So essentially I want to make a flow for when the order is delivered and have the single flow account for every product when it is delivered

However

I have upwards of 40+ products and I want the delivery email to contain at least 50 lines of certain text depending on the product
I wanted to make sure I can have an else if conditional that long (dependent on the product name) where each option will display these 50 lines in a conditional containing 40+ possibilities for these 50 lines

Would it be better to split the flow up?
Is there a chance the email will be considered flagged or rejected if there is this much text/email is too big in size?
Is there a significant amount of processing or resource use to do this? Will it be done in klaviyo before being sent out so no problem with that?
Will it take a long time because of this conditional?

Some answers to these and other pertinent concerns revolving this would be great or an additional approach that still lends itself to modification down the road without too much tedious work.

Thanks so much! 

Best answer by zacfromson

Thanks for you question! This is a really complex scenario and I can hopefully be able to help here.

In my opinion, the best solution for handling a flow with 40+ product-specific conditions while maintaining efficiency would be to use dynamic data in templates instead of large conditional blocks.

Rather than using 40+ {% elif %} conditions, leverage dynamic data from the product catalog using event variables.

Here is how you can do this efficiently:

  • If your event data includes product names, descriptions, or unique tags, use Klaviyo’s event variables ({{ event.extra.line_items }}) to pull in the correct text dynamically.
  • Store predefined messages in a custom profile property or catalog metadata and reference it using a lookup.

This way, it only loops through relevant products rather than checking 40+ static conditions.

You could also consider splitting the flow for large product groups. If your 40+ products can be grouped into categories, consider breaking them into smaller flows. Each flow can have shorter conditionals rather than a single massive block, making it easier to manage.

Too much text in an email can trigger spam filters. If there’s too much text, consider linking to a webpage with more details instead of embedding everything in the email.

If you have any additional question please let me know so I can provide additional context for you.

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

1 reply

zacfromson
Problem Solver III
Forum|alt.badge.img+1
  • 2025 Champion
  • 14 replies
  • Answer
  • February 7, 2025

Thanks for you question! This is a really complex scenario and I can hopefully be able to help here.

In my opinion, the best solution for handling a flow with 40+ product-specific conditions while maintaining efficiency would be to use dynamic data in templates instead of large conditional blocks.

Rather than using 40+ {% elif %} conditions, leverage dynamic data from the product catalog using event variables.

Here is how you can do this efficiently:

  • If your event data includes product names, descriptions, or unique tags, use Klaviyo’s event variables ({{ event.extra.line_items }}) to pull in the correct text dynamically.
  • Store predefined messages in a custom profile property or catalog metadata and reference it using a lookup.

This way, it only loops through relevant products rather than checking 40+ static conditions.

You could also consider splitting the flow for large product groups. If your 40+ products can be grouped into categories, consider breaking them into smaller flows. Each flow can have shorter conditionals rather than a single massive block, making it easier to manage.

Too much text in an email can trigger spam filters. If there’s too much text, consider linking to a webpage with more details instead of embedding everything in the email.

If you have any additional question please let me know so I can provide additional context for you.