I try to write an after plugin for the method getItemOptions
of the class \Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder
Attempt:
app/code/Company/Configurator/etc/di.xml
( I also tried app/code/Company/Configurator/etc/frontend/di.xml )
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder">
<plugin name="Company_Configurator_Plugin_Frontend_Magento_Sales_Block_Order_Email_Items_Order_DefaultOrder"
type="Company\Configurator\Plugin\Frontend\Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder"
sortOrder="10"/>
</type>
</config>
app/code/Company/Configurator/Plugin/Frontend/Magento/Sales/Block/Order/Email/Items/Order/DefaultOrder.php
<?php
/**
* Copyright © All rights reserved.
* See COPYING.txt for license details.
*/
namespace Company\Configurator\Plugin\Frontend\Magento\Sales\Block\Order\Email\Items\Order;
class DefaultOrder extends \Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder
{
public function afterGetItemOptions(
\Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder $subject,
$result
) {
exit("test");
return $result;
}
}
But it is still calling the original Method and my exit is getting ignored.
- Im using Magento 2.4.2
- There is no other plugin for that class