JavaScript Events
Multiple custom JavaScript events allow to react with own JavaScript on JavaScript which is executed after certain user actions.
List of events
The following events exists:
Event name | User action which triggers the event |
---|---|
extcode: | A BE variant of a product was chosen. |
extcode: | The country of billing or shipping address is updated. |
extcode: | The currency of the cart is updated. |
extcode: | The success/error message after adding a product to the cart will be hidden. |
extcode: | A product is added to the cart (which updates the mini cart). |
extcode: | A product is added to the cart which renders a success (or error) message. |
extcode: | Another payment option is chosen. |
extcode: | Another shipping option is chosen. |
Tip
The best way to understand when the event is executed and which data it
contains can be seen in it's context. Search in the directory
/Build/
for the event name.
How to listen for events
Every event comes with a detail object which contains data relevant for this specific event.
The following example shows how to listen for an event.
Extract of some JavaScript added with e.g. an AssetViewhelper
document.addEventListener("extcode:country-updated", (event) => {
console.log("The event 'extcode:country-updated' was fired.");
console.log("The event contains the following detail data:");
console.log(event.detail);
});
Copied!