According to https://www.wix.com/velo/reference/$w/carticon/addtocart this code should work, but it has not worked when I click on my button. Any sugegstions?
import { cart } from 'wix-stores'; $w("#button34").onClick(() => { cart.addProducts([{ "productId": "123456", "quantity": 1 }]) .then((updatedCart) => { // Products added to cart const cartId = updatedCart._id; const cartLineItems = updatedCart.lineItems; }) .catch((error) => { console.log(error); }); });