How to get the current product in Observer instead of this "$product = $this->_registry->registry("current_product");" I need the code for without registry in the observer.

  • On which observer do you want to get this product data?
    – Amit Bera
    Feb 13 at 16:16

1 Answer 1


**try this **

public function execute(\Magento\Framework\Event\Observer $observer)
    $product = $observer->getEvent()->getProduct();
    $productId = $product->getId();
    $productName = $product->getName();
    // You can use the product object to retrieve any other product details you need

Your Answer

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

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