Can someone help me how to update total price of order after removing item from list??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone help me how to update total price of order after removing item from list???

Update total price after remove

14th Feb 2023, 2:57 PM
Miriam Balázsová
Miriam Balázsová - avatar
6 Answers
+ 3
What is your attempt so far?
14th Feb 2023, 3:02 PM
Justice
Justice - avatar
+ 1
https://www.sololearn.com/compiler-playground/WAyWdJ5s3qj4 I hope you will find it. For this purpose I set ID as empty string, because I dont know how to add another js file here. Thanks a lot.
14th Feb 2023, 4:15 PM
Miriam Balázsová
Miriam Balázsová - avatar
+ 1
Thanks everyone for help... I solved it 😊😊
16th Feb 2023, 10:05 PM
Miriam Balázsová
Miriam Balázsová - avatar
0
Reading such 2 huge walls of text is a lot. Please link your code via a codebit from the Code Playground.
14th Feb 2023, 3:46 PM
Justice
Justice - avatar
0
Hi, I think using splice in your function remove_order is causing the issue Maybe instead of doing findIndex Do this Const newOrder = order. filter( searchOrder => searchOrder.id === id) This newOrder will be an updated list without the given item having said "id"
15th Feb 2023, 2:36 PM
ASM
ASM - avatar
0
Miriam Balázsová Also, Im curious Why are you saving list of prices in localStorage seperately Instead of having them in orders item directly like, Id: uuidv4(), item : e.target.name, number : ....., Price : (its price) ?
15th Feb 2023, 2:38 PM
ASM
ASM - avatar