Cart items quantity logic
The idea of the qty property is that rather than re-adding a product to the cart each time the addToCart method is called on the same product, we instead just increment the qty value.
Does that make sense? If not, stick with me and I'm sure the penny will drop.
To check if an item is already in the cart, we're going to iterate the cart array items and check their id to see if we get a match.
Click to load comments...