Open MarcosMene opened 1 year ago
Same problem here. Have you found a solution?
Hello. If I buy a product, I select quantity 2 and click Add to Cart button, il will appears 2 products at the bag. Ok it works great. But if I decide to buy another product. I click another product and it keeps the same quantity value of the first product. I need to change the value quantity to chose just 1 product. Does it happen with you too?
It's supposed to do that. and it's because of the way we've set the quantity, inside stateContext we change the quantity to what we want with the plus and minus options on the product page, and it is not reset when we add the item to the cart. If you want to reset that, you will have to reset the qty, with setQty method. If you want to reset after adding items to the cart, u have to put it inside the event handler of the cart button. If you wanna do that if you move to some other product page, then I think you can use the useEffect hook.
I can solve this, please allow me to fork the project. Thankyou,
Hello. If I buy a product, I select quantity 2 and click Add to Cart button, il will appears 2 products at the bag. Ok it works great. But if I decide to buy another product. I click another product and it keeps the same quantity value of the first product. I need to change the value quantity to chose just 1 product. Does it happen with you too?