How to allow adding only one item per product?


1, Open the "js/products/products.js" file.

2. Search for the "cart" object declaration and add the "exists" function like shown in the screenshot.

3. Search for the "addToCart" event binding and place the code in the "if" statement like shown in the screenshot.

4. Open the "js/products/views/itemView.js" file.

5. Remove or comment these lines of code in the "initialize" function.

6. Make sure all the products have a unique "code" property.


Last update:
2016-04-19 16:00
Author:
Vlad Sargu
Revision:
1.0
Average rating: 5 (1 Vote)