let cartItems = localStorage.getItem("ProductsinCart");
cartItems = JSON.parse(cartItems);
Object.values(cartItems).map(item => {
let productNumbers2 = localStorage.getItem('cartNumbers2');
productNumbers2 = parseInt(productNumbers2);
let cartcost = localStorage.getItem('totalCost');
cartcost = parseFloat(cartcost);
let inCart = item.inCart;
if (item.id === id)
{
localStorage.removeItem(cartItems[item.tag]);
console.log(cartItems);
}
CodingAllInOne:
description: “notNow”
id: 4
imgSrc: “./imagesForCart/programmingBooks/CodingAllInOne.jfif”
inCart: 1
inStock: 39
name: “Coding All In One”
price: 29.99
tag: “CodingAllInOne”
[[Prototype]]: Object
DesignPatterns:
description: “notNow”
id: 6
imgSrc: “./imagesForCart/programmingBooks/DesignPatterns.jfif”
inCart: 1
inStock: 39
name: “Design Patterns”
price: 9.99
tag: “DesignPatterns”
[[Prototype]]: Object