·

events

Events and Observers in Magento 2

Just like Magento 1, Magento 2 offers different ways to achieve your goal in your webshop. One of these things are all the events dispatched by Magento. So before you start rewriting models, overriding templates or adding new classes, chances are that you can get things done, just by listening what Magento has to offer. In read further ...

Detect changes on HTML element with the MutationObserver

Recently I ran in a situation of which I’m sure some of you also encountered at some point: I had to perform an action when the class of an element changed. This change was done by an external plugin and I didn’t want to edit to source of that plugin to provide a hook. So how did I read further ...

Unit testing frontend events in Magento

When you are creating unit tests for Magento and you want to test the events you’re dispatching you can use the following code to manually trigger your events: However, you’ll find that when you’re running this test, your event doesn’t get fired at all! That’s because this particular event (and many others) are fired read further ...