Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    How to Get Magento 2 Edition and Version

    In this blog, I will show how we can get the Magento edition name and the version number.

    When we are creating module which must be compatible with multiple versions of Magento 2 and/or must be compatible with both Magento 2 editions then we can use the edition name and/or the version number to write different code for each one if required. This approach is much better than creating multiple version of the module for minor Magento version upgrades. This makes maintenance as well testing easier.

    To get the Magento 2 edition and version we have to use \Magento\Framework\App\ProductMetadataInterface , don’t confuse ProductMetadata with catalog product. This refers to the installed Magento, which is a product of Magento, Inc.

    It will return edition name as Enterprise or Community and the version number like 2.4.0

    Please comment if you face any issue or if there is any confusion. Thanks for checking out the blog.

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close