Skip to content

after-plugin

Auto Added by WPeMatico

Magento 2 Plugin After Execute Controller

I have an existing controller that returns a JSON. public function execute() { $customer = $this->_customerModel->getById(175); $resultJson = $this->resultFactory->create(MagentoFrameworkControllerResultFactory::TYPE_JSON); $resultJson->setData( [ ‘status’ => ‘ok’, ‘message’ => ‘Success.’, ‘data’ => $customer->__toArray() ] ); return $resultJson; } I have created afterExecute() plugin,… Read More »Magento 2 Plugin After Execute Controller

Hot to create plugin for savePaymentInformationAndPlaceOrder method

This method is calling at checkout step but with plugin using after method it’s not calling, core method is calling. etc/di.xml <type name=”MagentoCheckoutModelPaymentInformationManagement”> <plugin name=”k365_payemnt_management_plugin” type=”K365CheckoutPluginModelPaymentInfoManagement” /> </type> PaymentInfoManagement.php <?php namespace K365CheckoutPluginModel; use MagentoCheckoutModelPaymentInformationManagement; class PaymentInfoManagement { public function afterSavePaymentInformationAndPlaceOrder(… Read More »Hot to create plugin for savePaymentInformationAndPlaceOrder method