1

I'm looking for similar event like sales_order_shipment_save_after and sales_order_shipment_save_before in Magento1.

Oh I am using Magento 2.1.3.

I tried

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_shipment_save_before">
        <observer name="poczta_beforeshipment" instance="Test\Poczta\Observer\BeforeShipment" />
    </event>
    <event name="sales_order_shipment_save_after">
        <observer name="pocztapolska_aftershipment" instance="Test\Poczta\Observer\AfterShipment" />
    </event>
</config>

But it is not working. I tried find it here https://cyrillschumacher.com/magento2-list-of-all-dispatched-events/ but I'm not sure what one is a correct.

Should I use observer via di instead event observer? http://blog.chapagain.com.np/magento-2-before-after-method-event-observer-using-plugin/

  • Your code should work, putting your event under etc/adminhtml folder: app/code/Vendor/Module/etc/adminhtml/events.xml – Khoa TruongDinh Jan 11 '17 at 13:37
  • <facepalm>. It works fine right now. Thanks ;) – Konrad Siamro Jan 11 '17 at 14:05
  • I leave my answer below. If it's helpful, please accept it. – Khoa TruongDinh Jan 11 '17 at 16:11
1

Your code should work, putting your event under etc/adminhtml folder: app/code/Vendor/Module/etc/adminhtml/events.xml.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.