Open Chrstjan opened 7 months ago
in the app.js file make a function in the controller code region called cartCallback
The function should
Recive the id of the clicked product from the buildProductCard functions
Have a productsInCart array to save the product object data's into
Loop thorugh the allProducts array and check for matching id's of the products
Add the matching data object into the productsInCart array
Make variable that JSON Stringifyes the array to be saved to local storage
Save the variable to local storage to be used in the buildShoppingCart function
in the app.js file make a function in the controller code region called cartCallback
The function should
Recive the id of the clicked product from the buildProductCard functions
Have a productsInCart array to save the product object data's into
Loop thorugh the allProducts array and check for matching id's of the products
Add the matching data object into the productsInCart array
Make variable that JSON Stringifyes the array to be saved to local storage
Save the variable to local storage to be used in the buildShoppingCart function