To support our customers during COVID-19 pandemic, we had introduced many
offers and discounts
to help your ecommerce businesses. Learn more

Magento 2 get base URL in phtml file

Magento 2 get base URL in phtml file

You can get base URL of front-end using Object Manager. Try below code.

$objectManager =  \Magento\Framework\App\ObjectManager::getInstance(); 

$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$store = $storeManager->getStore();
echo $store->getBaseUrl();

July 9, 2018
Did you like this post?
0
0