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)
Based on the formula I think that’s the total has to be.
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 )
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
Added this to your app and you can check!
Let me know if all works!
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?
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
Ok thanks I will check it out!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.