Need help to customize extension


I am trying to customize product template and for that, I checked below file:

In above file There is one function exists like getCurrentProduct and in template file I tried to get SKU value using the below code.
$block->getCurrentProduct()->getSku(); But getting below error.
Error: Uncaught Error: Call to a member function getSku() on null
Can you please advise it?

Hi there!

Can you tell me more about what you’re trying to achieve with this customization?

The getCurrentProduct method can only work on a product page, because it requires Magento to register the product in the registry.