It’s because of your “currentStateOpened”.
If you addd your first Item it will be set to false and thus the second item will have as total price “0”.
However, you probably should code the whole thing differently. I hope that is for training purposes to get started with JS and you don’t plan on using that in real life 🙂
1
solved Google’s Simple Shopping Cart [closed]