12

In Magento 1, you can use Mage::getVersion(). But I can't find code for getting version in Magento 2.

32

[1] Via Code

   $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
   $productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface');
   $version = $productMetadata->getVersion(); //will return the magento version

[2] Go to CLI, Locate your Magento Root Folder & Run below command

php bin/magento --version

Output

Magento CLI version 2.1.1

Which print your Current Magento Version

[3] If you open composer.json on Magento Root You can find as well

"require": {
        "magento/product-community-edition": "2.1.1",

[4] From Admin Side, On Right Hand Side Footer Also You can see

  • For the third method, it is unlikely to happen, but if you executed the comand composer require magento/product-community-edition 2.1.8 --no-update (recommended way to upgrade) but did not execute composer update after, you will see the version as 2.1.8, but your Magento won't be at that version yet. – Cladiuss Aug 17 '17 at 14:36
6

On top of the other answer, you can get the major version (for example 2.1) by accessing /magento_version on your Magento 2 website.

  • And please, disable this feature as soon as you can.. bin/magento module:disable Magento_Version – Ricardo Martins Nov 13 '18 at 23:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.