Skip to main content
Solved

Using if statements in metric flow


Forum|alt.badge.img+2
  • Contributor I
  • 1 reply

I’m creating a metric flow in Klaviyo and have an event variable, amount_dollars, that gets sent with each payload. Within an email that triggers off of the flow, I want to change one word depending on how large amount_dollars is; e.g. I want it to say “extremely” if amount_dollars is greater than 500. I tried writing the following into my email within the flow:

{{% if event.amount_dollars>500 %}}extremely {{% endif %}}

 

But when I do, I get an error message. How can I create an if statement based on metric event variables?

Best answer by Dov

Hello @Lle4,

Thank you for sharing your question with the Klaviyo Community.

Your “if” statement should only have a single bracket around each item and should also include a space between dollars and the figure. So using the example of 100 instead of 500 dollars it should look like the following:

Thanks and have a wonderful day!

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

2 replies

Dov
Forum|alt.badge.img+61
  • Klaviyo Alum
  • 1493 replies
  • Answer
  • June 17, 2021

Hello @Lle4,

Thank you for sharing your question with the Klaviyo Community.

Your “if” statement should only have a single bracket around each item and should also include a space between dollars and the figure. So using the example of 100 instead of 500 dollars it should look like the following:

Thanks and have a wonderful day!


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 1 reply
  • June 17, 2021

Thanks so much!!