I use next code:
$w.onReady(function() { let item = $w('#dynamicDataset').getCurrentItem(); $w("#button7").onClick(() => { $w("#widget8").addToCart(item._id) .then(() => { console.log("Product added"); }) .catch((error) => { console.log(error); }); });
});
item is correct and it has id
#button7 is a button,
#widget8 has CartIcon type
but click return undefined and not add to cart.
What's wrong?
Hi @shop.pokapoka
have you found the answer? I am having the same issue
What do you mean widget is cart type? The addToCart can only be used on the shopping cart icon on your site, nowhere else. Try that.