Each cart button has to be linked to a different product, but I can’t find out how to add something like a cart button to the data collection of my dynamic page. Would anyone have any ideas??
https://support.wix.com/en/article/adding-and-setting-up-a-standalone-add-to-cart-button
https://www.wix.com/corvid/reference/$w.CartIcon.html#addToCart
https://www.wix.com/corvid/reference/$w.CartIcon.html#addProductsToCart
Also, take a look in the related posts box on this forum post…
https://www.wix.com/corvid/forum/community-discussion/dynamic-add-to-cart-button
First, add a regular button to your dynamic page. Name it, for example, button1.
Check the name of your cart button. Rename, if needed. In my example, it is called just cart.
Add onClick event to that button. Here button1_click
Add code:
export function button1_click(event) {
const productId = $w( ‘#dynamicDataset’ ).getCurrentItem()._id;
$w( ‘#cart’ ).addToCart(productId);
}
1 Like