# Checkout total calculation not working

**URL:** <https://forum.adalo.com/t/checkout-total-calculation-not-working/29768>\
**Category:** Get Help\
**Created:** [July 21, 2022, 10:48am UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768 "2022-07-21T10:48:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxZHou](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@MaxZHou](https://forum.adalo.com/u/MaxZHou)\
**Post date:** [July 21, 2022, 10:48am UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768/1 "2022-07-21T10:48:39Z")

</div>

Hi everyone

So I basically cloned an eCommerce app to see how the shopping feature worked, and I have followed the same workflow and database with the e-commerce app to build my own, however, my app is currently struggling to calculate the correct total, does anyone know how to solve this problem? Thanks!

(the clothing app is mine, and the one with a drink bottle in cart is the app I cloned)

 ![Screen Shot 2022-07-21 at 8.43.06 pm](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/5/d/5dad8721bb70887533452544baea80d74515f9e4.jpeg)  
 ![Screen Shot 2022-07-21 at 8.43.32 pm](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/3/3/3373da0fb574a3731b10fdf9fba817725417d817.jpeg)  
 ![Screen Shot 2022-07-21 at 8.45.17 pm](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/2/1/21352c1563ef662cd94f894046557c978e9434d1.jpeg)  
 ![IMG_7216.HEIC](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/c/b/cb9d36847bfa3143c99a99eb06fecdc61b94b159.jpeg)

 ![IMG_7215.HEIC](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/c/1/c11a29126f30579f876f7dfdf13eea9de588e945.jpeg)

---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 21, 2022, 1:04pm UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768/2 "2022-07-21T13:04:03Z")

</div>

Hi @MaxZHou,

Based on the formula I think that’s the total has to be.

> **Calculation**
>
> 46 + 17 = 63  
> 1 + 3 ( quantities) = 4  
> sum of price \* sum of quantity = 63 \* 4 = 252 ( This is not the result you get. I checked your app and the prices for these are decimals )  
> ![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/e/0/e0dc130be764904cc193fa7556e22a65ceb7a0dd.png)  
> ![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/7/b/7bd9f760b8e4ab67401a966713fbd6bfcffdeca6.png)  
> 45.99 + 16.99 = 62.98  
> 1 + 3 ( same quantities ) = 4  
> sum of price \* sum of quantity = 62.98 \* 4 = 251.92 ( and this is the result you got )

I believe what you have to get is :

45.99 \* 1 = 45.99  
16.99 \* 3 = 50.97  
cost = 45.99 + 50.97 = 96.96

What you can do is when adding items to cart ( creating a record in the cart collection ) you can directly multiply the price by the quantity and do the same thing for add and minus button and display the price.

You can check here a example : [Renew order items quantity - #11 by dilon\_perera](https://forum.adalo.com/t/renew-order-items-quantity/28865/11)

Added this to your app and you can check!

Let me know if all works!

Thank you

---

<div class="post-metadata">

**Author:** ![MaxZHou](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@MaxZHou](https://forum.adalo.com/u/MaxZHou)\
**Post date:** [July 21, 2022, 1:13pm UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768/3 "2022-07-21T13:13:50Z")

</div>

Hey there, I didn’t quite get what you mean, do you mean when a user adds something to the cart I create an update cart action and have a formula in there?

---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 21, 2022, 6:46pm UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768/4 "2022-07-21T18:46:00Z")

</div>

I mean update the price with the quantity or create a new property and do this and display that!

Check this video : [order quantity.mp4 - Google Drive](https://drive.google.com/file/d/1JXObaFcEq0T1eH9Wp720HYeMkxm_fndU/view?usp=drivesdk)

---

<div class="post-metadata">

**Author:** ![MaxZHou](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@MaxZHou](https://forum.adalo.com/u/MaxZHou)\
**Post date:** [July 22, 2022, 5:33am UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768/5 "2022-07-22T05:33:37Z")

</div>

Ok thanks I will check it out!

---

<div class="post-metadata">

**Author:** ![MaxZHou](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@MaxZHou](https://forum.adalo.com/u/MaxZHou)\
**Post date:** [July 23, 2022, 8:04am UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768/6 "2022-07-23T08:04:10Z")

</div>

It worked thanks!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/system/32/40401_2.png) [@system](https://forum.adalo.com/u/system)\
**Post date:** [August 2, 2022, 8:04am UTC](https://forum.adalo.com/t/checkout-total-calculation-not-working/29768/7 "2022-08-02T08:04:56Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
