Block/Snippets.php
public function getCurrentProduct()
    {
        try {
            $product = $this->coreRegistry->registry('current_product');
            if ($product instanceof Product) {
                return [
                    'sku' => $product->getSku(),
                    'id'  => $product->getId(),
                ];
            }
        } catch (\Exception $e) {
            throw $e;
        }

        return false;
    }
public function getCurrentProduct()
    {
        try {
            $product = $this->coreRegistry->registry('current_product');
            if ($product instanceof Product) {
                return [
                    'sku' => $product->getSku(),
                    'id'  => $product->getId(),
                ];
            }
        } catch (\Exception $e) {
            throw $e;
        }

        return false;
    }
public function getCurrentProduct ( ) { try { $ product = $ this -> coreRegistry -> registry ( 'current_product' ) ; if ( $ product instanceof Product ) { return [ 'sku' => $ product -> getSku ( ) , 'id' => $ product -> getId ( ) , ] ; } } catch ( \ Exception $ e ) { throw $ e ; } return false ; }
Get Current Product

@return bool|mixed
@throws \Exception
Get Current Product