Create a module

Module is a structural element of Commerce – the whole system is built upon modules. Typically, the first step in creating a customization is building a module.

Who is this video for?

  • Developers

Steps to add a module

  • Create the module folder.
  • Create the etc/module.xml file.
  • Create the registration.php file.
  • Run the bin/magento setup.
  • Upgrade script to install the new module.
  • Check that the module is working.

module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Training_Sales">
        <sequence>
            <module name="Magento_Sales"/>
        </sequence>
    </module>
</config>

registration.php

<?php

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(
    ComponentRegistrar::MODULE,
    'Training_Sales',
    __DIR__);

Useful resources

On this page