0

I just want to execute some code during remove wishlist item like m1 does with controller_action_predispatch_wishlist_index_remove event. I have checked with Magento 2 all events on https://cyrillschumacher.com/magento2-list-of-all-dispatched-events/ URL. There is no event for remove wishlist item.

Is there any way to perform this?

Any help would be appreciated.

Thanks in advance.

1

controller_action_predispatch event executed in every action of Magento and the event you are talking about is dynamic that's why you are not able to find in the link which you have provided and in core Magento.

Not let's check your event controller_action_predispatch_wishlist_index_remove in this event controller_action_predispatch is static event name and wishlist_index_remove is your action (I mean to remove item from the wishlist). Magento create this dynamic event on every action.

Just look in this line of Magento\Framework\App\Action\Action class

$this->_eventManager->dispatch(
            'controller_action_predispatch_' . $request->getFullActionName(),
            $eventParameters
        );

You can see controller_action_predispatch_ is statically written and $request->getFullActionName() is dynamic. So in your case you are performing removing Item from wishlist so your full action name wishlist_index_remove that's why your event name replace by controller_action_predispatch_wishlist_index_remove

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.