Skip to main content
Contributor I
January 4, 2022
Solved

How can i show (or not) compare at price?

  • January 4, 2022
  • 3 replies
  • 1188 views

Hello, 

 

I trying to do a conditional sentence inside a text block for show or not compare_at_price depending if item has or not discount on feed. But after add following code to text block i can’t save content and doesnt work.

Is for Shopify store.

Code:

{{ item.title }}
{% if item.price < item.compare_at_price %}
{% currency_format item.price %} {% currency_format item.compare_at_price %}
{% else %}
{% currency_format item.price %}
{% endif %}

 

Can anyone help me?

 

Thanks a lot, Kae

    This topic has been closed for replies.
    Best answer by sourabh

    Hey @Kae

    Could you provide some more information about where you are trying to implement the code? If it is in a flow or a campaign. 

    I am assuming that you are trying to add the above piece of code in one of your flow emails. If that is the case, could you at least tell me what metric is being used to trigger the flow or what flow it is and I will be able to guide you through it properly. 
     

    3 replies

    stephen.trumble
    Klaviyo Alum
    January 5, 2022

    Hey @Kae 

    Thank you so much for coming to the Klaviyo Community to get with with your syntax for your email template.

    @Mailbox Manny Would you happen to know why this isnt working for Kae?

    -Stephen
    Mailbox Manny
    Partner - Silver
    Partner - Silver
    January 15, 2022

    @Kae Sorry, I’m late here.  Did you find a solution for this? 

    Subscribe. Segment. Send. Repeat.
    sourabh
    Partner
    sourabhAnswer
    Partner
    January 19, 2022

    Hey @Kae

    Could you provide some more information about where you are trying to implement the code? If it is in a flow or a campaign. 

    I am assuming that you are trying to add the above piece of code in one of your flow emails. If that is the case, could you at least tell me what metric is being used to trigger the flow or what flow it is and I will be able to guide you through it properly. 
     

    Sourabh | Let's connect - Twitter: @sourabhramsingh, Linkedin: linkedin.com/in/sourabhramsingh/