use \Magento\Framework\Registry;
class Test extends Action
{
protected $registry;
public function __construct(
Registry $registry
)
{
$this->registry = $registry;
}
public function execute()
{
$proid = $this->registry->registry('current_product')->getId();
}
}
->getId()` showing Error "Fatal error: Uncaught Error: Call to a member function getId() on null"