Magento 2.3 Hook an event in 'Submit Shipment' process in Sales Order View(Adminhtml) — New Shipment Form

magento.stackexchange https://magento.stackexchange.com/questions/259088

문제

I want to hook some event on Submit Shipment button in Sales Order View New Shipment Form.
I want the event to hook when admin clicks on Submit Shipment button.

Has anyone tried to do it before? Which file should be overridden?
Any reference please.

Please check the image below:

enter image description here

도움이 되었습니까?

해결책

I solved this after making some researching

Through Overriding New Shipment Save Controller using a Plugin

app/code/Vendor/CustomModule/etc/adminhtml/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">

    <preference for="Magento\Shipping\Controller\Adminhtml\Order\Shipment\Save"
                type="Vendor\CustomModule\Controller\Adminhtml\Order\Shipment\Save" />
</config>

app/code/Company/Module/Controller/Adminhtml/Order/Shipment/Save.php

<?php

namespace Company\Module\Controller\Adminhtml\Order\Shipment;

class Save extends \Magento\Shipping\Controller\Adminhtml\Order\Shipment\Save
{
   //did my custom logic here 
}

reference: Magento 2 - sales_order_shipment_save_after

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top