If you have done the above which it looks like you have, then it won’t work as the standalone button is connected to each product through the button’s own settings.
I followed the advise from GOS and the new coded button worked, however the site still does not stay on page after the product has been added to cart. Below is the code I’m using, is there anything I can alter to have it stay on page?
Thanks!
@givemeawhisky
I have an issue with the mobile version. My addTocCart code is working fine, but I would like the customer to stay on the page instead of being redirected to the cart page. This happens on the mobile version only.
I have the opposite problem: with similar code, my add to cart button adds items but does not work link straight to the cart which is my goal; it just opens the mini cart.
What am I doing wrong
export function addToCartButton_click(event, $w) {
let prod = dataset.getCurrentItem(); // declared above
let colors = prod['productOptions']['Color']['choices']
let sizes = prod['productOptions']['Size']['choices']
// selectedOptions is handled outside this function
selectedOptions['Color'] = colors[selectedColor].description;
selectedOptions['Size'] = sizes[selectedSize].description;
$w('#shoppingCartIcon').addToCart(prod._id, 1, {choices: selectedOptions})
.then(()=>{console.log('add successful')}, (err)=>{console.log(err)});
//wixLocation.to('/Cart') // attempted redirection that did not work
}
I have the same question! How to stay on page after add to cart. How to skip the Mini Cart?? My add to cart code works fine as well, but why would we want our mobile customers to stop shopping? Buy more, please!
I found a simple solution! I was having the same problem on mobile mode.
There is no easy way to specifically turn this off for mobile, however there is a way you can turn it off on desktop, and it will reflect on mobile.
To do this, you will need to open the product page on desktop version, then you will need to select settings and select stay on product page.
I only had “stay on product page” selected for my shop. But not for the product page. Here is a video of my mobile version now.