Magento How To Get Current Magento Version

In this blog post, we will see how to get current Magento version:

Magento1:

echo Mage::getVersion(); //will return the current Magento version

Magento2:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productMetaData = $objectManager->get('Magento\Framework\App\ProductMetadataInterface');
$version = $productMetaData->getVersion();
echo $version; //will display the current Magento version

Hope this helps!

 

Leave a Reply