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.
1 Answer
**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
}