How can I display the amount a person would save if they apply a coupon?

  • 22 March 2023
  • 3 replies


I want to show and calculate the amount a person would save if they apply a coupon.

I can show cart total with  {{event.extra.SubTotal}}

E.g. I want to show how much they would save if they applied a 10% discount.

However, I cannot find any information about math calculations, or whether Klaviyo even uses liquid.


any help is appreciated!


Best answer by Tonio 23 March 2023, 09:32

View original

3 replies

Userlevel 7
Badge +59

Hey @BenAdams,

Welcome to the Klaviyo Community!

Although you can perform certain math calculations in templates such as addition, multiplication, and division, subtraction is not supported. You can check our Glossary of variable filters Help Center article to see of our most commonly used ones. 

Our templates utilize Django and you can find the full scope here.

I hope this helps!


Userlevel 3
Badge +8

Klaviyo does support Liquid, to calculate the amount a person would save with a coupon, you can use the following Liquid code:

{% assign discount_percent = 10 %}
{% assign sub_total = event.extra.SubTotal %}
{% assign discount_amount = sub_total * discount_percent / 100 %}
{% assign total_with_discount = sub_total - discount_amount %}

You saved {{discount_amount | currency}} with your {{discount_percent}}% discount!
Your new total is {{total_with_discount | currency}}.

This code sets the discount percentage to 10%, retrieves the subtotal from the event.extra object, calculates the discount amount, and subtracts it from the subtotal to get the new total with the discount applied.

You can customize the discount percentage and currency formatting to suit your needs.


That’s great thank you.


I ended up doing this: ${{event.extra.SubTotal|multiply:0.1|round_up:2}}