How to override this below file? Pepperjam\Network\Model\Beacon\Itemized.php
I need to override protected function inside this file, I tried with reference but not working
I have add override using plugin method but it is not working please advise if I am wrong:
In etc/di.xml add below code
<?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="Pepperjam\Network\Model\Beacon\Itemized">
<plugin name="cmarix-pepperjam-itemized-model" type="[VendorName][ModuleName]\Plugin\ItemizedPlugin" sortOrder="1" />
</type>
</config>
And In [VendorName][ModuleName]\Plugin\ItemizedPlugin.php file add below code
<?php
namespace [VendorName][ModuleName]\Plugin;
class ItemizedPlugin
{
protected function aftergetQuantity($item)
{
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/afterlog.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('Your text message');
if ($item->getProduct()->canConfigure()) {
return 0;
} else {
return (int) $item->getQtyOrdered();
}
}
}
?>