Cookies help us enhance your experience on our site by storing
information about your preferences and interactions. You can customize your
cookie settings by choosing which cookies to allow. Please note that disabling
certain cookies might impact the functionality and features of our services,
such as personalized content and suggestions.
Cookie Policy
These cookies are strictly necessary for the site to work and may not be disabled.
Cookie name
Description
Lifetime
Provider
_ce.clock_data
Store the difference in time from the server's time and the current browser.
1 day
Crazy Egg
_ce.clock_event
Prevent repeated requests to the Clock API.
1 day
Crazy Egg
_ce.irv
Store isReturning value during the session
Session
Crazy Egg
_ce.s
Track a recording visitor session unique ID, tracking host and start time
1 year
Crazy Egg
_hjSessionUser_2909345
Store a unique user identifier to track user sessions and interactions for analytics purposes.
1 year
HotJar
_hjSession_2909345
Store session data to identify and analyze individual user sessions.
1 day
HotJar
apt.uid
Store a unique user identifier for tracking and personalization.
1 year
Mageplaza
cebs
Store user preferences and settings.
Session
Mageplaza
cf_clearance
Store a token that indicates a user has passed a Cloudflare security challenge.
1 year
Cloudflare
crisp-client
The crisp-client/session cookie is used to identify and maintain a user session within the Crisp platform. It allows the live chat system to recognize returning users, maintain chat history, and ensure continuity in customer service interactions.
Session
Crisp
_ga
Store a unique client identifier (Client ID) for tracking user interactions on the
2 years
Google
_ga_7B0PZZW26Z
Store session state information for Google Analytics 4.
2 years
Google
_ga_JTRV42NV3L
Store session state information for Google Analytics 4.
2 years
Google
_ga_R3HWQ50MM4
Store a unique client identifier (Client ID) for tracking user interactions on the website.
2 years
Google
_gid
Store a unique client identifier (Client ID) for tracking user interactions on the website.
1 day
Google
_gat_UA-76130628-1
Throttle the request rate to Google Analytics servers.
1 day
Google
Advertising cookies
Advertising cookies deliver ads relevant to your interests, limit ad frequency, and measure ad effectiveness.
Advertising cookies deliver ads relevant to your interests, limit ad frequency, and measure ad effectiveness.
Cookie name
Description
Lifetime
Provider
_gcl_au
The cookie is used by Google to track and store conversions.
1 day
Google
__Secure-3PAPISID
This cookie is used for targeting purposes to build a profile of the website visitor's interests in order to show relevant and personalized Google advertising.
2 years
Google
HSID
This security cookie is used by Google to confirm visitor authenticity, prevent fraudulent use of login data and protect visitor data from unauthorized access.
2 years
Google
__Secure-1PSID
This cookie is used for targeting purposes to build a profile of the website visitor's interests in order to show relevant and personalized Google advertising.
2 years
Google
SID
This security cookie is used by Google to confirm visitor authenticity, prevent fraudulent use of login data and protect visitor data from unauthorized access.
2 years
Google
APISID
This cookie is used by Google to display personalized advertisements on Google sites, based on recent searches and previous interactions.
2 years
Google
__Secure-1PAPISID
This cookie is used for targeting purposes to build a profile of the website visitor's interests in order to show relevant and personalized Google advertising.
2 years
Google
__Secure-3PSID
This cookie is used for targeting purposes to build a profile of the website visitor's interests in order to show relevant and personalized Google advertising.
2 years
Google
SSID
This cookie is used by Google to display personalized advertisements on Google sites, based on recent searches and previous interactions.
2 years
Google
SAPISID
This cookie is used by Google to display personalized advertisements on Google sites, based on recent searches and previous interactions.
2 years
Google
__Secure-3PSIDTS
This cookie collects information about visitor's interactions with Google services and ads. It is used to measure advertising effectiveness and deliver personalised content based on interests. The cookie contains a unique identifier.
2 years
Google
__Secure-1PSIDTS
This cookie collects information about visitor's interactions with Google services and ads. It is used to measure advertising effectiveness and deliver personalised content based on interests. The cookie contains a unique identifier.
2 years
Google
SIDCC
This security cookie is used by Google to confirm visitor authenticity, prevent fraudulent use of login data, and protect visitor data from unauthorized access.
3 months
Google
__Secure-1PSIDCC
This cookie is used for targeting purposes to build a profile of the website visitor's interests in order to show relevant and personalized Google advertising.
1 year
Google
__Secure-3PSIDCC
This cookie is used for targeting purposes to build a profile of the website visitor's interests in order to show relevant and personalized Google advertising.
1 year
Google
1P_JAR
This cookie is a Google Analytics Cookie created by Google DoubleClick and used to show personalized advertisements (ads) based on previous visits to the website.
1 month
Google
NID
Show Google ads in Google services for signed-out users.
6 months
Google
Analytics cookies
Analytics cookies collect information and report website usage statistics without personally identifying individual visitors to Google.
Analytics cookies collect information and report website usage statistics without personally identifying individual visitors to Google.
Cookie name
Description
Lifetime
Provider
_dc_gtm
Manage and deploy marketing tags through Google Tag Manager.
1 year
Google
1P_JAR
Gather website statistics and track conversion rates for Google AdWords campaigns.
1 month
Google
AEC
1 month
Google
ar_debug
Debugging purposes related to augmented reality (AR) functionalities.
1 month
Doubleclick
IDE
The IDE cookie is used by Google DoubleClick to register and report the user's actions after viewing or clicking on one of the advertiser's ads with the purpose of measuring the effectiveness of an ad and to present targeted ads to the user.
1 year
Doubleclick
ad_storage
Enables storage, such as cookies (web) or device identifiers (apps), related to advertising.
1 year
Google
ad_user_data
Sets consent for sending user data to Google for online advertising purposes.
1 year
Google
ad_personalization
Sets consent for personalized advertising.
1 year
Google
analytics_storage
Enables storage, such as cookies (web) or device identifiers (apps), related to analytics, for example, visit duration.
How to create a simple Hello World module for Magento 2 - Mageplaza
How to create a simple Hello World module for Magento 2
Vinh Jacker|03-17-2025
According to eMarketer’s projections, retail ecommerce sales are anticipated to escalate from $4.938 trillion in 2021 to $7.391 trillion by 2025. To capitalize on this growth, learning to develop a custom module in Magento 2 can significantly boost sales by adding unique functionalities to your online store.
In this guide, we will outline five essential steps to create a custom module in Magento 2. Let’s explore!
Looking for Magento Development Company?
8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.
A custom module in Magento 2 is a package of code designed to add specific features or functionalities to an online store. It allows developers to extend, customize, or modify Magento’s default behavior without altering the core code. Custom modules can introduce new product types, payment gateways, shipping methods, or other features tailored to meet unique business needs, ensuring a flexible and scalable e-commerce platform.
Steps to Create a Custom Module in Magento 2
To create custom modules, you need to complete the following high-level steps:
Step 1: Create the folder of Hello World module
Step 2: Create etc/module.xml file
Step 3: Create etc/registration.php file
Step 4: Enable the module
Step 1: Create the folder of Hello World module
Name of the module is defined as VendorName_ModuleName. First part is name of the vendor and last part is name of the module:
For example: Magento_HelloWorld, Mageplaza_PdfInvoice. Focus on following guide to create the folders:
app/code/Mageplaza/HelloWorld
Step 2: Create etc/module.xml file.
Then, it is necessary to create etc folder and add the module.xml file
Finish the step 3, we have already created the HelloWorld module. And we will enable this module in this step
After create the module if you run the command as:
phpbin/magentomodule:status
You should see the module is disable now:
List of disabled modules:
Mageplaza_HelloWorld
Follow exact guide to enable the module right now, let run the command as:
phpbin/magentomodule:enableMageplaza_HelloWorld
Or other way, you can access the file:
app/etc/config.php
You will see a long list of modules there, just add your module as well
...'Mageplaza_HelloWorld'=>1,...
Your module should be available now.
After this step, when you open your website in browser you will get an error saying
Please upgrade your database: Run bin/magento setup:upgrade from the Magento root directory.
Let run the command:
phpbin/magentosetup:upgrade
If you encounter issues with stuck indexers after enabling your module, you may need to unlock the reindex process in Magento 2 to continue development smoothly.
After complete,when you open your website in browser you will see the layout of the website is broken.
Please run the deloy command line to fix it.
php bin/magento setup:static-content:deploy
After deploy completed, you can also see your module from backend at System Configuration -> Advanced -> Disable Modules Output.
After completed, please run php bin/magento cache:clean to check result.
Your URL now should be as:
http://<yourhost.com>/helloworld/index/test
We hope that the above easy-to-understand guide will help you successfully create a custom module in Magento 2.
Need help building something more advanced? Explore our Custom Magento Development Services and bring your ideas to life with expert support.
FAQ
1. What is module.xml in Magento?
module.xml is a configuration file in Magento that defines the specifics of a Magento module. This file provides crucial information such as the module’s name, version, and dependencies. Magento modules follow a structured folder hierarchy, which includes the vendor (a collection of related modules) and the module itself. The module.xml file, located within this structure, helps Magento identify the module’s properties and requirements, ensuring proper integration and functionality within the Magento framework.
2. How can you call ( activate) a module in Magento 2?
To activate a module in Magento 2:
Create Module Structure: Place your module under app/code/VendorName/ModuleName.
Create module.xml: Define module details like name and version in etc/module.xml.
Create registration.php: Register the module with Magento.
Enable Module: Use CLI command php bin/magento module:enable VendorName_ModuleName.
Run Setup Upgrade: Update Magento database and configuration with php bin/magento setup:upgrade.
Clear Cache: Ensure changes take effect by clearing cache with php bin/magento cache:clean and php bin/magento cache:flush.
Following these steps will activate your module in Magento 2, making it operational within the system.
3. Can I create multiple modules within the same Magento 2 instance?
Yes, Magento 2 allows you to create and manage multiple modules within the same Magento 2 instance. Modules in Magento are like building blocks that allow you to extend or modify the core system’s functionality.
4. Where are Magento modules stored?
Magento modules are stored in the app/code directory of your Magento installation. Specifically, they are organized into vendor-specific folders within app/code. For example, if the vendor name is VendorName and the module name is ModuleName, the module’s files are located in app/code/VendorName/ModuleName. This directory structure helps Magento manage and organize modules according to their respective vendors and names, facilitating easy customization and extension of the platform’s functionalities.
5. Is it possible to create a module that integrates with third-party APIs?
Yes, it is possible to create a module in Magento 2 that integrates with third-party APIs. Magento 2 provides robust capabilities for developers to build custom modules that interact with external APIs seamlessly. Learn how to expose your module via Magento 2 API if you want your module to expose endpoints and interact via RESTful requests. Here are the general steps:
Module Setup: Create the module structure in app/code/VendorName/ModuleName.
Configuration: Set up module files (module.xml and registration.php) and define dependencies.
API Integration: Write PHP classes to manage API requests and responses using Magento’s service contracts or custom classes.
Authentication: Securely manage access with OAuth tokens or API keys.
Data Handling: Use models, helpers, or repositories to manage data synchronization and transformation between Magento and the API.
Automation: Use event observers and cron jobs for automated tasks like data updates and - synchronization.
Testing and Debugging: Thoroughly test in different environments and use Magento’s debugging tools for problem-solving.
Security and Performance: Enhance security and optimize performance for efficient API communication.
Jacker is the Chief Technology Officer (CTO) at Mageplaza, bringing over 10 years of experience in Magento, Shopify, and other eCommerce platforms. With deep technical expertise, he has led numerous successful projects, optimizing and scaling online stores for global brands. Beyond his work in eCommerce development, he is passionate about running and swimming.
Discover a step-by-step framework for effective social media marketing. Learn how to optimize content, run ads, track KPIs, and future-proof your strategy across all major platforms.
Discover a step-by-step framework for effective social media marketing. Learn how to optimize content, run ads, track KPIs, and future-proof your strategy across all major platforms.
Discover a step-by-step framework for effective social media marketing. Learn how to optimize content, run ads, track KPIs, and future-proof your strategy across all major platforms.
Discover a step-by-step framework for effective social media marketing. Learn how to optimize content, run ads, track KPIs, and future-proof your strategy across all major platforms.