12

This question already has an answer here:

In magento 1, you can use Mage::getVersion(). But i can't found code get version in magento 2. Could you help me?

marked as duplicate by Khoa TruongDinh, Fabian Schmengler, Rakesh Jesadiya, Raphael at Digital Pianism, 7ochem Oct 11 '16 at 9:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

31

[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.