CLI Documentation Notice
You're viewing documentation for the new Wix CLI, which we recommend for all new projects.
Events are triggered when specific conditions occur in your project. For app projects, these are conditions on a Wix user's site. For headless projects, they're conditions on your project's site. Your project can respond to these events using event extensions. Events in the Wix CLI are built on JavaScript SDK webhooks, and event extensions subscribe your project to these webhooks behind the scenes.
Learn more about event extensions.
Follow the instructions below to:
Once this task is complete, your project will have an event extension that's triggered when a specific event occurs.
Important:
You can't have 2 event extensions listening to the same event in your app. Each event can only have one handler. This includes extensions added to your app in the app dashboard, not only those in the local files for your project.
In the terminal:
Navigate to your project repo.
Run the generate command.
The CLI will display a menu of extensions to generate. Select Event and hit enter to continue.
The CLI will prompt you to name your event folder. This is the name of the folder in the project directory that contains the event code, and the name of the event. Only you will see this name.
Upon completion, the extension files will be created in your project directory with the following structure:
Learn more about event extension files and code.
For app projects: You may need to configure permissions for your app to receive the event.
To test your event extension you must:
Once your project is ready for production, you can build and deploy it.
Note: When you release an app project, you release a new version of the app allowing you to publish the app to the Wix App Market or install it on a site with a direct install URL. You can view your app's versions in the app dashboard.
To delete an event extension from your project:
.use() statements for the extension from the extensions.ts file.For app projects:
If you already have a version of your app project, you must build and deploy the project again after removing the event extension files.