Solved

# Order confirmation email - Dynamic table is showing wrong total for line items with quantity more than 1

• 3 replies
• 370 views

+2

Hello!

I am having an issue with my Order Confirmation email: line item totals displaying properly when the quantity is more than 1. I am editing a Klaviyo template for Shopify export. The correct Subtotal is displaying in the static row below, accounting for the quantities. The issue is only with the line item total in the table. The line items are currently set up like this:

This is how the emails are displaying to customers:

The price of the chair is \$2,750.00 each, so the total for that line item with quantity of 2 should be \$5,500.00

Further, I would like the total per line item to display the discounted total (for items with applied discounts only) next to the correct total, like this:

Total: \$5,500 \$0.00

(the total is showing \$0.00 because I applied a 100% coupon as a test, but in the event of a 10% off coupon, it should read: \$5,500 \$4,950.00

I would appreciate help with this.

Thank you,

Hi @AdamB here's what you can do:

1. Access the Klaviyo account and find the dynamic abandoned cart block where you want to display the item total and discounted total.
2. Create a formula or script that calculates the item total and the discounted total based on the price and quantity of the chair, and the discount applied. (How to do this I will write below)
3. Use a placeholder or merge tag to insert the calculated total and discounted total into the dynamic abandoned cart block.
4. Test the dynamic abandoned cart block to make sure that it displays the correct item total and discounted total.
5. Save the changes to the dynamic abandoned cart block.

You can create a formula or script using Klaviyo's Liquid language to calculate the item total and the discounted total in your abandoned cart flow. The exact implementation may vary based on your specific requirements, but here's an example formula you can use as a starting point:

1. {% assign item_total = item.price * item.quantity %}
2. {% assign discount_amount = item_total * item.discount_percent / 100 %}
3. {% assign total_with_discount = item_total - discount_amount %}
• Item Total: {{ item_total | money }}
• Discounted Total: {{ total_with_discount | money }}

In this formula, item.price is the price of the item, item.quantity is the quantity of the item in the cart, item.discount_percent is the discount percentage applied to the item, and | money is a Liquid filter that formats the number as currency.

This formula calculates the item total by multiplying the price and quantity, calculates the discount amount by multiplying the item total and discount percentage, and calculates the total with discount by subtracting the discount amount from the item total.

You can then use this formula or a modified version of it in your Klaviyo abandoned cart flow to display the item total and discounted total.

These are general steps and the exact implementation may vary depending on your specific requirements and Klaviyo account setup.

Best regards,
Iryna

### 3 replies

Userlevel 5
+15

Hi @AdamB here's what you can do:

1. Access the Klaviyo account and find the dynamic abandoned cart block where you want to display the item total and discounted total.
2. Create a formula or script that calculates the item total and the discounted total based on the price and quantity of the chair, and the discount applied. (How to do this I will write below)
3. Use a placeholder or merge tag to insert the calculated total and discounted total into the dynamic abandoned cart block.
4. Test the dynamic abandoned cart block to make sure that it displays the correct item total and discounted total.
5. Save the changes to the dynamic abandoned cart block.

You can create a formula or script using Klaviyo's Liquid language to calculate the item total and the discounted total in your abandoned cart flow. The exact implementation may vary based on your specific requirements, but here's an example formula you can use as a starting point:

1. {% assign item_total = item.price * item.quantity %}
2. {% assign discount_amount = item_total * item.discount_percent / 100 %}
3. {% assign total_with_discount = item_total - discount_amount %}
• Item Total: {{ item_total | money }}
• Discounted Total: {{ total_with_discount | money }}

In this formula, item.price is the price of the item, item.quantity is the quantity of the item in the cart, item.discount_percent is the discount percentage applied to the item, and | money is a Liquid filter that formats the number as currency.

This formula calculates the item total by multiplying the price and quantity, calculates the discount amount by multiplying the item total and discount percentage, and calculates the total with discount by subtracting the discount amount from the item total.

You can then use this formula or a modified version of it in your Klaviyo abandoned cart flow to display the item total and discounted total.

These are general steps and the exact implementation may vary depending on your specific requirements and Klaviyo account setup.

Best regards,
Iryna

+2

Hi @Irrra,

Thanks for your suggestions. I will follow your steps and see if I can fix the issue accordingly.

Best,

Userlevel 5
+15

Hi Adam, happy to help =)