addToCart function for a TextButton

Hi Roi!
Can you tell me where should I put this function? Because when I tried to put this
$w(‘#addToCart’).onClick(()=>{$w(‘#shoppingCartIcon1’).addToCart(product.id);});
It didn’t work

function myItemReady($w, wishlistItem){
let product = wishlistItem.product;
$w(‘#productImage’).src = product.mainMedia;
$w(‘#name’).text = product.name;
$w(‘#price’).text = product.formattedPrice;
$w(‘#productImage’).onClick(()=>{
wixLocation.to(product.productPageUrl);
});
$w(‘#addToCart’).onClick(()=>{$w(‘#shoppingCartIcon1’).addToCart(product.id);});
$w(‘#removeItem’).onClick(removeItem(wishlistItem._id));
}

function removeItem(id) {
return async function () {
await wixData.remove(‘wishlist’, id);
loadWishlist();
}
}