How to use helper directly in phtml file

Sometimes we need to use functions of helper class directly in our phtml files and we don’t want to create block class and pass helper in it. So whenever you need to call helper’s function directly in your phtml file then use the below code:

$helper = $this->helper('Vendor/Module/Helper/Class_Name');

And the use the functions of helper as:

$helper->some function()

Try this, I hope it will help you.

Leave a Reply

Your email address will not be published. Required fields are marked *