Skip to main content
Solved

multiply formula with an if/else option

  • October 16, 2024
  • 1 reply
  • 25 views

Forum|alt.badge.img

We have a shopify website linked to klaviyo. The prices for each product are without VAT. When showing this in mails (e.g. for abandoned cart products), I need to show the total price. We managed to do this with the multiply function.

Price: {% currency_format item.line_price|multiply:1.21|floatformat:1 %}

However, the discount field works the same way. I cannot use the same exact formula, because there are:

  • discounts with a percentage (uses the non-VAT price to calculate this → we need to multiply this)
  • discounts with a fixed amount → we do not need to multiply this

The discounts are created in shopify.

Any ideas on how to navigate this? I was thinking in the lines of:

  • is there a way to add an if/else statement to the multiply part? (we could make sure each code name has a specific part in the name to use in the if/else statement)
  • duplicate the discount block, make one for fixed amounts and one for percentages, and then use show/hide logic? (but how to create the logic then)
  • …?

Best answer by Taylor Tarpley

Hi there @smeyvaert 

 

Thanks for sharing your question! 

 

@annasophiefc , @bluesnapper@retention any ideas on how to approach this?

 

-Taylor

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

1 reply

Taylor Tarpley
Community Manager
Forum|alt.badge.img+60
  • Community Manager
  • 2148 replies
  • Answer
  • October 18, 2024

Hi there @smeyvaert 

 

Thanks for sharing your question! 

 

@annasophiefc , @bluesnapper@retention any ideas on how to approach this?

 

-Taylor