I am trying to set up a button that adds an item to the cart and redirects the user to a different page at the same time, i dont want wix to open up the mini kart or redirect to checkout.
The part where the button redirects i got it to work(below) but i cant get the add to cart fuction to work
import wixLocation from 'wix-location';
$w.onReady(function(){
$w('#button14').onClick(function(){
wixLocation.to("/contato");
});
});
$w.onReady(function(){
$w('#column1').onClick(function(){
wixLocation.to("/contato");
});
});
i´ve tried using this code from wix´s help center but i cant find a way to put the right product in the product id part next to .addtocart in red
$w("#button14").onClick( () => {
$w("#myShoppingCartIcon").addToCart("ea77f230-558f-0ba565e8f827")
.then( () => {
console.log("Product added");
} )
.catch( (error) => {
console.log(error);
} );
} );
thanks for the help in advance