Hi @genry-manashirov and @doron-alkalay ,
I am facing this issue now but I am not being able to debug it since my database is not filling up even with the simplest test. I leave you the code below:
import wixStoresBackend from 'wix-stores-backend';
//import wixStores from 'wix-stores-backend';
//import wixEvents from 'wix-events';
//import wixPay from 'wix-pay-backend';
import wixPayBackend from 'wix-pay-backend';
import wixData from 'wix-data';
export function wixStores_onCartCreated(event) {
let total = event.cartId;
let testItem = {
test1: "hello"
};
let options = {
"suppressAuth": true,
"suppressHooks": true
};
wixData.insert("testdatabase", testItem, options);
}
My database is this one:
I am testing the same code to fill the database with a test button on my client side and it is working, so it definetely looks like the event is not being triggered.
Do you see what I am doing wrong?
thanks in advance
Hi @enriquegomezlimia
Please pay attention, that the event is fired only on published site. Is the test database collection and the /backend/events.js file published?
Also, can you please try adding a log there? (console.log) You can view published site logs via the feature: https://support.wix.com/en/article/corvid-viewing-live-site-events
Also, what is your site’s url? I will take a closer look.
Best regards,
Genry.
Hi @genry-manashirov thanks for the reply,
Yes the web is published . Here you can check my web www.idilyo.com
I will meanwhile explore the addition of logs
Best,
Enrique
Hi @enriquegomezlimia
From our internal logs, I see that in the last 24 hours there were 2 events on this site. The first one was failed because the code was importing wix-events module at that time, which is a client side module, thus the failure, it was retried after few minutes, and was successful (probably after a code change on the site removing the wix-events import).
The second event was successful on first try. The times of the 2 events were (UTC Zero):
- March 24th 2020, 20:37:20
- March 25th 2020, 01:29:24
Please let me know if you still have any issues.
Best regards,
Genry.
@jbotterill Hello any update on this issue?
For future readers:
I didn’t have cart events firing until I changed
import wixStores from 'wix-stores-backend';
to
import wixStoresBackend from 'wix-stores-backend';
Additionally, the documentation is also vague as it sort of implies you get an event each time an item is added to the cart but this doesn’t appear to be the case.
wixStores_onCartCreated appears to only trigger on the creation of a cart.