Solved

Not showing dollar sign for abandoned cart email

  • 6 January 2023
  • 3 replies
  • 97 views

Badge +1

hi, 

 

I’ve followed this guide https://help.klaviyo.com/hc/en-us/articles/115002779411-How-to-create-an-abandoned-cart-flow to set up the abandon cart, but I cant insert the dollar sign before the product price.

 

{{ event.Items.0 }}

 {{ event.extra.line_items.0.variant_price }}

 

May I know how should I insert the code {{ event|lookup:'$currency_code' }} on above to show the dollar sign?

 

I have tried to insert the code like below, but dollar sign will be also shown even though there’s no 2nd product.

Edit mode

 

Preview mode

Please help, thanks!

icon

Best answer by David To 6 January 2023, 17:43

View original

3 replies

Userlevel 7
Badge +60

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

Badge +1

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 }}

 

 

Userlevel 7
Badge +60

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

Reply