I can't observe "cataloginventory_stock" event because in \Magento\CatalogInventory\Model\Stock model
property named $eventPrefix instead of $_eventPrefix
Hi @myownspace ,
Thank you for reporting! Internal ticket created: MAGETWO-54066
As a workaround you can use plugin for public method for add additional behaviour to model
Is there a reason this fix hasn't been released yet?
I just realised that this also requires a fix to the $_eventObject attribute name. Without this fix the event always passes the event data as 'Object' instead of the expected 'Stock' and 'Item'.
Hi @mslabko any idea when this patch will be released ? It's a pitty that issues fixed so long time ago are still pending for release.
Hi @tmotyl , @Silarn As I can see issue was fixed in https://github.com/magento/magento2/commit/bffd1c01d5f0ba22719e09af6323a12c186c3803 but code is not includes fix for $_eventObject
I've reopened internal ticket. Sorry for delay response
This issue was fixed in develop branch.
Closed.
should the event cataloginventory_stock_item_save_after dispatched on any inventory change? I'm able to use use it on admin but not after and order is placed
No, there are several events you'll need to hook into to cover all possibilities. There's a free Magento 1 plugin which covers these cases and I think it's roughly the same in Magento 2. I'll find it and add it to this post shortly.
thank you @Silarn, currently working on a M2 version https://github.com/apedicdev/m2_stock-movement
Most helpful comment
Is there a reason this fix hasn't been released yet?I just realised that this also requires a fix to the $_eventObject attribute name. Without this fix the event always passes the event data as 'Object' instead of the expected 'Stock' and 'Item'.