Skip to content

plugin

Auto Added by WPeMatico

Magento 2 plugin not working for MagentoBundleModelProductType when also applied on AbstractType

I am trying to use plugins on the following Magento 2 core methods: MagentoBundleModelProductType::checkProductBuyState() MagentoBundleModelProductType::getOptionsIds() MagentoCatalogModelProductTypeAbstractType::checkProductBuyState() Core classes (simplified) MagentoBundleModelProductType extends MagentoCatalogModelProductTypeAbstractType: class MagentoBundleModelProductType extends MagentoCatalogModelProductTypeAbstractType { public function checkProductBuyState($product) { parent::checkProductBuyState($product); $productOptionIds = $this->getOptionsIds($product); // … more logic return… Read More »Magento 2 plugin not working for MagentoBundleModelProductType when also applied on AbstractType

Magento 2 Plugin around Shipping collectRates infinyte loader

When I added __construct whatever I get an infinite loader. public function __construct(ResultFactory $res){ $this->anotherVariable = $res; } my <?php namespace VendorModulePlugin; use MagentoFrameworkAppConfigScopeConfigInterface; class MyShippingPlugin { private $anotherVariable; public function __construct(ScopeConfigInterface $res){ $this->anotherVariable = $res; } public function aroundCollectRates(… Read More »Magento 2 Plugin around Shipping collectRates infinyte loader

magento2 afterGetPrice plugin catalog rule not working on the final price

<?php namespace [Vendor][Name]PluginMagentoCatalogModel; class Product { protected $objectManager; public function __construct( MagentoFrameworkObjectManagerInterface $objectManager ) { $this->objectManager = $objectManager; } public function afterGetPrice( MagentoCatalogModelProduct $subject, $result ) { return $result + 100; } }