Hello @kanlam,
Welcome to the Klaviyo Community!
For your scenario, I think you’ll need to create an if/else statement to prevent the {{ event|lookup:'$currency_code' }}
variable from populating for the second product. Since the {{ event|lookup:'$currency_code' }}
variable is top level data not referencing an array item, it’s expected that it would display even if there wasn’t a second product present. I would suggest formulating your logic statement that evaluates if the second product is true or not. This way, if the second product is false - not present/available, then the {{ event|lookup:'$currency_code' }}
variable wouldn’t display either.
Our template expert, @Anna McCarthy has a great Community post and video explaining how to write your own if/else statements that I would recommend reviewing:
Another thing you may want to consider is building your dynamic table blocks in the traditional method of dynamically stacking on top of one another as opposed to being side to side. Because the standard method of building a dynamic table block uses the block repeat function, although the {{ event|lookup:'$currency_code' }}
variable is top level, it wouldn’t be repeated. If you’re reconsidering this option, you can checkout Anna’s other post on how to build a traditional dynamic table block:
I hope this helps!
David
thanks @David To
i just tried to add the price code like below, but seems to have error
{{ event.Items.0 }}
{{% currency_format event.extra.line_items.0.variant_price }}
Hey @kanlam,
{{% currency_format event.extra.line_items.0.variant_price }}
wouldn’t be a viable variable syntax you’re using - hence the error message.
I would suggest taking a look at our How to use event variables to personalize flows and How to build dynamic blocks in a flow email (new editor) Help Center article to learn more about using event variables in your emails and how to build dynamic blocks with them.
If you need more hands on assistance, I would encourage you to reach out to some of our many wonderful Klaviyo Partners who specialize in email design and/or development work.
David