Magento 2 CMS is an excellent option to develop an online store. However, it may not be enough for modern business requirements. To overcome the default limitations, there are Magento 2 extensions available in the market that extend the functionality of Magento 2. You can also opt to create module in Magento 2 rather than approaching any third party extension providers. However, you may have tons of questions regarding Magento 2 module development such as how one can develop Magento 2 module that helps the Magento 2 store to increase store facility, what are the most important things for the development of a module and so on. Well, don’t worry. Here we have prepared a comprehensive guide on creating your first Magento 2 module. To create a module or extension in Magento 2, you need to create these important files.
- module.xml
- registration.php
Steps to create a module in Magento 2:
1. Create module.xml at app/code/Cozmot/Extension/etc In module.xml file, copy and paste this code.
1
2
3
4
5
6
|
<?xml version=“1.0”?>
<config xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:noNamespaceSchemaLocation=“../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd”>
<module name=“Meetanshi_Extension” setup_version=“1.0.0”>
</module>
</config>
|
1
2
3
4
5
6
7
|
<?php
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
‘Cozmot_Extension’,
__DIR__
);
|
1
2
3
|
php bin/magento setup:upgrade
php bin/magento setup:static–content:deploy –f
php bin/magento cache:flush
|
