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/

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

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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