Events.js not triggering

Hi Wix team,

I have an issue with triggering events.js file. This issue has been reported many times by other members in corvid forum but there was no final solution provided. Can you guys check the issue and help us to solve it.

Here is the corvid forum link to the issue :
https://www.wix.com/corvid/forum/community-discussion/events-js-oncartcreated-not-working

I did all the suggestions written by the admins in corvid forum but it is not simply working!

thanks a lot.

Hi there! This seems like a question for our #CorvidMasters. Glad to see that you posted in the Corvid forum as well :slight_smile:

Which API are you using? Can you please provide the code

Hi Shan, I am using store backend Api, and here is the code in event.js file

import wixStores from 'wix-stores-backend';

export function wixStores_onCartCreated(event) {
   console.log(event) 
}
 

So this code should actually print the event in the site monitoring tool when the cart is created. And I tested it from the live site and noting is happening in the site monitoring tool. Here is the API reference link

Working fine for me.

Note that the backend file name must be events.js

With a ‘s’

Strange. It’s not working for me. Yes the file names is events.js. it was a typo when I typed here…

I did notice that the event only fires when you add the item from the individual product page and it will not fire if you add the item from the quick view window on the main shop page.

Can you check from the product page

@shantanukumar847 I have a custom “Add to cart” button and I am using code to add the product to the cart. Not sure if that is causing this different behaviour…

this might be the issue. it seems that the event only fires when the ‘Add to cart’ button on the Wix Stores Product page is clicked.

I cheked it from the individual product page… But I have a custom made Add to cart button using code.

Aha…ok…Maybe.
I will try soon with the wix store product page add to cart button and will update the status here… If it’s the case then there should be a fix/product improvement from side of wix corvid team. Thanks for the support @shantanukumar847 @brett