can someone help me, i have created a custom add to cart button. it keeps on jumping to the cart page after i clicked on the button. is there a way to not let this happen?
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
I'm having the same issue, would love a solution for this !
ok, the code is this:
// For full API documentation, including code examples, visit https://wix.to/94BuAAs import wixData from 'wix-data'; $w.onReady(function () { //TODO: write your page related code here... });
export function searchBar_keyPress(event) { //Add your code for this event here: if (event.key === 'Enter') { let searchWord = $w('#searchBar').value; $w('#dataset1').setFilter(wixData.filter() .contains('name', searchWord) ) } } export function addToCart_click(event, $w) { //Add your code for this event here: const productId = $w('#dataset1').getCurrentItem(); $w('#shoppingCartIcon1').addToCart(productId._id, 1) .then(()=>{ console.log('product added') }) }
How are you doing this add to cart button?
Did you add the add to cart button through the Wix Stores app?
https://support.wix.com/en/article/adding-and-setting-up-a-standalone-add-to-cart-button
Or did you add it through code as shown in the Wix API Reference here.
https://www.wix.com/corvid/reference/$w.CartIcon.html#addToCart
https://www.wix.com/corvid/reference/$w.CartIcon.html#addProductsToCart
If it is the second option, then you should be pasting up any used code for this in your forum post as advised in the forum guidelines.