cart.js
// Adds items to cart once "ADD TO CART" button is clicked
Adds items to cart once "ADD TO CART" button is clicked
Adds items to cart once " ADD TO CART " button is clicked
function addToCartClicked(event) {
    var button = event.target
    varShopItem = button.parentElement.parentElement
    var title = shopItem.getElementsByClassName('shop-item-title')[0].innerText
    var price = shopItem.getElementsByClassName('shop-item-price')[0].innerText
    var imgSrc = shopItem.getElementsByClassName('shop-item-image')[0].src
    addItemToCart(title, price, imageSrc)
}
function addToCartClicked ( event ) { var button = event . target varShopItem = button . parentElement . parentElement var title = shopItem . getElementsByClassName ( 'shop-item-title' ) [ 0 ] . innerText var price = shopItem . getElementsByClassName ( 'shop-item-price' ) [ 0 ] . innerText var imgSrc = shopItem . getElementsByClassName ( 'shop-item-image' ) [ 0 ] . src addItemToCart ( title , price , imageSrc ) }
Adds items to cart once "ADD TO CART" button is clicked
Adds items to cart once " ADD TO CART " button is clicked