top of page

Dynamic Add-to-Cart Button for Custom E-commerce Stores

Updated: Dec 30, 2024



Velo Code:


import { cart } from 'wix-stores';

export function addToCart_click(event) {
    let product = $w('#dynamicDataset').getCurrentItem();
    let idProduct = product.productReference;

    $w('#shoppingCartIcon1').addToCart(idProduct)
        .then(() => {
            console.log("Product Added");
            cart.showMiniCart();
        })
        .catch((error) => {
            console.log(error);
        });
}

Enjoy!

Scene 02 (0-00-00-26).jpg

elevate your client projects?

Transform Your Projects with the Ultimate 2024-2025 Wix Studio Template Bundle!

Group 8.png
bottom of page