Magento

How to get a custom variable into a phtml file?

Pinterest LinkedIn Tumblr

We are using object manager to get the value.

// get custom variable value
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$variable = $objectManager->create('Magento\Variable\Model\Variable');
$value = $variable->loadByCode('site_link_frontend')->getPlainValue();
Faster PHP Cloud Hosting