🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Check if a Module is Enabled or Not Programmatically in Magento 2

By Chandresh ChauhanUpdated on May 22, 2025 1 min read

Many times, developers would come across a requirement to check if a module is enabled or disabled in a Magento 2 store.

It happens when one needs to check about the module’s status is a multi-store or when you are using third-party modules.

Use the isEnabled() function as shown below to check if a module is enabled or not programmatically in Magento 2.

Method to check if a module is enabled or not programmatically in Magento 2:

<?php

namespace [Vendor]\[Module]\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Framework\Module\Manager;

class Data extends AbstractHelper
{
    protected $moduleManager;

    public function __construct(
        Context $context,
        Manager $moduleManager
    )
    {
        $this->moduleManager = $moduleManager;
        parent::__construct($context);
    }
    
    public function isEnable()
    {
        if ($this->moduleManager->isEnabled('[Vendor]_[Module]')) {
            //code for Module is enabled
            return 1;
        } else {
            //code for Module is disabled
            return 0;
        }
    }
}

Note: The above method checks only if the module is enabled in the configuration or not. It does not support checking the status for the admin panel.

That’s it.

Also, please share the solution with the Magento community via social media.

Thank you.

Chandresh Chauhan Full Image
Article byChandresh Chauhan

He has been with Meetanshi for more than three years now as a certified Magento developer. A silent guy whom you can always find solving clients' issues, is an avid reader too.