Shopware resources and help articles

Simple and to the point. Optimized by the community.

Before the AddToCart event.

1
by Thomas Truelsen, last modified on December 1st, 2022

When you need a simple action before the add to cart event happen, like analytics or other logic triggers.

For more complex interactions see override / extend plugin.

For minor actions use the code below, this works runtime after JS plugins have been initialized.

PluginManager.getPluginInstances("AddToCart").forEach(function (element) {
    element.$emitter.subscribe('beforeFormSubmit', function (event) {
        console.log("ADD TO CART", event)
    });
});

Works from ^6.3

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?