catalog_compare_item_delete_after
Magento 2 event dispatched from Magento_Catalog. Observers bound to this event run whenever the code path that dispatches it executes.
Dispatch location(s)
Every place in Magento 2 core where catalog_compare_item_delete_after is fired. Open the file in your local Magento source to see the event arguments passed alongside the name.
Observer skeleton
Paste into your module's etc/events.xml + create the matching Observer class. Adjust the vendor/module namespace to yours.
1. etc/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="catalog_compare_item_delete_after">
<observer name="vendor_module_catalog_compare_item_delete_after"
instance="Vendor\Module\Observer\CatalogCompareItemDeleteAfter"/>
</event>
</config>2. Observer class
<?php
declare(strict_types=1);
namespace Vendor\Module\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class CatalogCompareItemDeleteAfter implements ObserverInterface
{
public function execute(Observer $observer): void
{
$event = $observer->getEvent();
// Read whatever payload this event carries. Check the
// dispatch() call in core to see the exact keys.
// Example: $product = $event->getProduct();
// Your observer logic here.
}
}Need the full module scaffolded around this observer? Module Generator wires the events.xml, observer class, and module registration for you.
Related events in Magento_Catalog
Siblings you might also observe in the same module.
adminhtml_catalog_category_tree_can_add_root_category
Magento_Catalog · 1 dispatch site(s)
adminhtml_catalog_category_tree_can_add_sub_category
Magento_Catalog · 1 dispatch site(s)
adminhtml_catalog_category_tree_is_moveable
Magento_Catalog · 1 dispatch site(s)
adminhtml_catalog_product_attribute_edit_frontend_prepare_field_dependencies
Magento_Catalog · 1 dispatch site(s)
adminhtml_catalog_product_attribute_edit_frontend_prepare_form
Magento_Catalog · 1 dispatch site(s)
adminhtml_catalog_product_attribute_set_main_html_before
Magento_Catalog · 1 dispatch site(s)
Every Magento dev tool, in one hosted workspace.
Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.