I have tried to call my observer when stock is updated. Here is my etc/adminhtml/events.xml code

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="cataloginventory_stock_item_save_after">
        <observer name="tct_stock_item_save_observer" instance="Namespace\Module\Observer\Notifier" />

And here is my observer's code


namespace Namespace\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use \Psr\Log\LoggerInterface;

class Notifier implements ObserverInterface {

  public function __construct(
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    LoggerInterface $logger
  ) {
    $this->_storeManager = $storeManager;
    $this->logger = $logger;

  public function execute(Observer $observer) {
    $this->logger->warn('Observer Works');


I have tried magento 2 event cataloginventory_stock_item_save_after but that didn't work.

But its not working. Please help.

  • I have tried that already. That didn't work then I had to raise a new query.
    – Manish Joy
    Jun 29 '17 at 7:30

You an try this its working for me.




use Magento\Framework\Event\ObserverInterface;

class Productsaveafter implements ObserverInterface
    public function execute(\Magento\Framework\Event\Observer $observer)
        $_product = $observer->getProduct();  // you will get product object
        $_sku=$_product->getSku(); // for sku

  • for the same event??
    – Manish Joy
    Jun 29 '17 at 6:11
  • yes you can implement that for the same event Jun 29 '17 at 6:12
  • I tried die($_sku); but after saving the product it didn't work.
    – Manish Joy
    Jun 29 '17 at 7:04

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