Hello,
Anyone else with the same problem?
Yesterday it was working but now it isn't and I haven't change anything in this function. Thanks in advance
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.
Yes, I've been having this issue on 2 of my sites on different situations with google chrome browser. It's been a nightmare as I have a sale going on and people can't add to cart!!!
To add to Alexander's post above, you should really be using something like a button click event to use the addToCart or addProductsToCart functions instead of the code line of 'export function addProduct(event) {' if you are just using it as it is on its own.
As mentioned in the tutorial linked from the original post and reply from hugomarinhodroid, the add to cart part is still a seperate button and the code used in the tutorial itself is setup to work with other parts of the code elsewhere, so you can not just simply take part of the code and expect it to work on your own site.
https://support.wix.com/en/article/corvid-tutorial-adding-multiple-items-to-the-cart-in-a-wix-stores-site#step-16-create-the-addtocartbutton_click-function-1
Step 16: Create the addToCartButton_click Function
The addToCartButton_click() function is wired to the add to cart button in step 3 of the customization process. The button is used to add the selected bracelet and charms to the store's shopping cart.
export async function addToCartButton_click(event, $w) { let itemsToAdd = [{productID: selectedBracelet._id, quantity: 1, options: {}}]; selectedCharms.forEach(function(charm){ itemsToAdd.push({ productID: charm._id, quantity: 1, options:{} }); }); let res = await $w('#shoppingCartIcon').addProductsToCart(itemsToAdd); }
Lines 2-4: Define the bracelet and charms to be added to the shopping cart. Line 6: Add the bracelet and selected charms all at once to the store's shopping cart.
Example site add to cart button
Editor add to cart button
Same issue here and Wix support was not helpful.
it was working perfectly on the 20th and then by the same time of this post I faced the same issue. I have been trying to crack it since then with no luck.
today I have started a new site and started testing and it is also not working.
any tips?
I have the same problem here! Some weeks ago it was working fine( I haven´t changed code), but now it just works when published!
NOW only works when published
I've tried to rename back to "shoppingCartIcon" and the error is still the same.
I've also opened in the editor the template linked in this article and it's not working either and some days ago it was working.
I not use the AddToCartItem because the code below is a simple version of what the code is and was just for testing (the id is valid).
The id name should be #shoppingCartIcon and not #Cart, so first simply try changing it back to what it was originally called when Wix Stores was added to your site and what is used in the code as well.
https://www.wix.com/corvid/reference/$w.CartIcon.html#addToCart
//rest of code// $w('#myShoppingCartIcon').addToCart("ea77f230-558f-0ba565e8f827") //rest of code//