How to Create a Custom Theme in Magento 2 – Step-by-Step

A Magento 2 theme controls how your online store looks and feels, from homepage banners to product grids and checkout pages. To understand it better, consider it like a shop-front window — it’s the first impression for every visitor. Like, when you visit Amazon India during Prime Day, or Nykaa’s Pink Friday Sale, the colours, […]

Sanjay Modasia 96x96

Sanjay Modasia

Founder & CEO

April 16, 2025

Custom Theme in Magento 2

A Magento 2 theme controls how your online store looks and feels, from homepage banners to product grids and checkout pages. To understand it better, consider it like a shop-front window — it’s the first impression for every visitor. Like, when you visit Amazon India during Prime Day, or Nykaa’s Pink Friday Sale, the colours, buttons, layouts and product displays are all managed by their theme. Custom themes are much more than looks — they directly affect loading speed, usability and how trustworthy your store feels.

Most shoppers in India use mobile phones. So when you create a theme, make sure it’s mobile-friendly and loads quickly. Google ranks fast websites higher. Nykaa and Flipkart optimize their themes with compressed images and clean CSS to stay ahead.

Before we come to how to create a custom theme in Magento 2, lets us now know a few necessary things:

For Indian ecommerce sellers, a tailored theme allows you to align with local trends — like creating festive layouts for Diwali, adding cash-on-delivery icons or showcasing regional language banners.

Developers who build themes enable sellers to stand out in a crowded marketplace. Which means that even small tweaks like image placements or add-to-cart buttons can increase sales. For businesses, good design equals brand power and better customer retention. That’s why companies investing in custom Magento themes often explore bold strategies like integrating with Magento 2 Extensions Development to unlock advanced features and flexibility.

Why Magento 2 Theme Development Matters in India:

Magento 2 powers some of the most scalable and performance-focused eCommerce stores in the world. In India, where shopping experiences are influenced by cultural trends, festivals, payment preferences, and mobile-first usage, creating a custom Magento 2 theme is not just a visual update — it’s a business strategy.

According to Statista, over 82% of Indian eCommerce traffic comes from mobile. A responsive, festive, and fast-loading theme can increase customer trust, reduce bounce rate, and maximize conversions.

Pre-requisites of Theme Creation in Magento 2:

Theme Creation in Magento 2

The following skills will help you handle everything from layout tweaks to adding product banners:

  • Before you start, you’ll need a working Magento 2 installation. This step for Magento 2 theme development, needs to be done either on your local machine or a web server.
  • You should also be familiar with basic web languages like HTML, CSS and XML.
  • Plus, you must know how to access and edit files in your Magento directory.

Understanding Magento’s Theme Structure:

Magento Theme Structure (2)
Magento Theme Structure (2)

Magento stores all themes inside the design frontend directory. This structure ensures every visual change — from the homepage slider to product thumbnails — stays organized and reusable.

  • For example, if you’re designing a site for selling sports shoes:
  • Your theme defines where product titles, price tags and add-to-cart buttons appear.
  • The theme.xml file provides key metadata like the theme’s title, its parent theme (often Luma), and a preview image for admin selection.
  • Registration.php is another critical file, telling Magento to register your theme for use during setup upgrades.
  • Static assets like CSS control product card designs, JavaScript adds interactivity (like hover effects on images) and image folders store assets like promotional banners for limited-time sales.
  • The layout and template folders decide where and how your product information is shown — for example, highlighting a “50% Off” badge on men’s watches or showcasing a “New Arrival” ribbon for summer kurtas on your homepage.

If you’re planning to modernize your store while keeping your current content, Magento 2 Migration Services can be a smart step before diving into full theme customization.

Read Also: Guide on How To Hire a Magento Developers With Expert Tips & Questions To Ask

Step-by-Step Theme Creation for Magento 2 with Real Ecommerce Examples:

When you run an online store, your design defines your brand. To create custom theme in Magento 2 step by step, you have to think of, for example Amazon’s clean layout or Nike’s bold website — both follow strict theme structures. Magento lets you create your own theme and here’s exactly how to do it.

1. Create Vendor and Theme Folders:

The first step for custom themes in Magento 2: Let’s say you run an online store called MyVendor and you are launching a special theme for your summer shoe collection. Go to the design folder, open the frontend folder and create two new folders. Name the first folder MyVendor and name the second folder mytheme. This helps Magento keep your themes neat and linked to your brand, just like how Zara uses specific themes for seasonal sales.

2. Define the Theme Configuration:

Doing this is a must in Magento theme 2 development. Open the mytheme folder and create a new file called theme dot xml. This file tells Magento your theme’s name, which existing theme it builds on, and the image you want to show in the admin preview. For example, for your shoe store theme, your theme dot xml might look like this:

  • Title is My Custom Shoe Theme
    – Parent is Magento Luma
    – Media preview image is media preview dot jpg

This helps Magento identify the design setup and lets you reuse Luma’s base code. Big ecommerce stores, like Flipkart, often reuse parent themes. Especially during new launches this helps save time and ensure stability.

3. Register the Theme:

Step by Step Theme Creation for Magento 2
Image Source: Cloudways

Just creating a theme isn’t enough, you need to register the Magento custom theme.

Inside the mytheme folder, create a new file called registration dot php. This file registers your theme with Magento so it shows up during setup. The script tells Magento your theme name and location. When you run setup upgrade later, Magento will list MyVendor mytheme as available. This is similar to how Shopify detects a new uploaded theme in its backend.

4. Set Up View Configuration:

Inside the mytheme folder, create an etc. folder and then create view dot xml. This file controls your product images. Suppose you want product images for shoes to show as three hundred pixels by three hundred pixels. You write that inside view dot xml. If your store runs a new handbag collection, you can change this to five hundred by five hundred. Brands like Nykaa and Ajio often use this logic to serve optimized images for mobile and desktop views. This is a very crucial steps for theme creation in Magento 2.

5. Add Basic Styling and Static Assets:

Inside the mytheme folder, create a web folder. Inside the web, create four folders named css, fonts, images, and js. These folders will hold your website’s styles, icons, product photos, and JavaScript code. Always use LESS files instead of plain CSS files. LESS makes it easier to manage large stylesheets, just like Amazon uses preprocessors for consistent and scalable design.

If you’re also planning to enhance performance and introduce better UX interactions, Magento 2 upgrade services can support your theme by keeping your store fast and secure.

6. Override Layout or Template Files:

If you want to replace the default Magento product page, create a Magento catalog folder inside your mytheme folder. Inside that, add templates or layout files.

Suppose you want to show a limited edition badge on your shoes. You can copy the original product view template into your mytheme folder and add the badge code. This is how online stores highlight best sellers, new arrivals, or flash deals. Another crucial stage of Magento 2 theme development.

7. Activate the Theme:

Log in to your Magento admin panel, go to Content, then Design and then Configuration. Pick your store view and select My Custom Shoe Theme from the list. If you want to activate the theme using commands, you can set the theme using Magento CLI. Larger stores like Pepperfry use it during deployments.

8. Run Setup and Deploy Commands:

Setup and Deploy Commands in Magento 2

Now open your terminal and run three important commands.

  • Run setup upgrade to register your theme.
  • Flush the cache so old data is removed.
  • Deploy static content to load CSS and images properly.

This process of theme creation in Magento 2 is just like Myntra running a refresh before their End of Season Sale goes live.

Read Also: Magento vs Shopify: How to Choose the Right E-commerce Platform?

Make Your Magento 2 Theme Festive-Ready for Indian Holidays

Indian shoppers spend big during Diwali, Eid, Christmas, and Independence Day. With Magento, you can create seasonal child themes under your base theme. Here’s how:

  • Use Diwali-themed banners with gold and maroon colors
  • Add a tricolor badge on the homepage during Republic Day
  • Highlight “Festive Combo Deals” with layout updates
  • Show “Pay with UPI” and “Cash on Delivery” icons prominently
  • Schedule theme activations via CLI before events

CTA:
To create a custom theme in Magento 2  isn’t just about creating a design — it’s a business strategy. Studies show 75% of users judge a company’s credibility based on website design alone. As per STATISTA, in India, where 82% of ecommerce traffic comes from mobile. In short, your theme can make or break sales. Ready to create a storefront that truly sells? Get in touch with us!

FAQ’s:

1. Can I create multiple custom themes for different store views in Magento 2?

Yes! Magento allows you to assign different themes for different store views — perfect for multilingual or regional stores.

2. What’s the difference between a parent theme and a child theme?

A parent theme (like Luma) contains reusable code. A child theme extends it with customizations while preserving upgrade compatibility.

3. Is it necessary to use LESS over CSS?

Yes, Magento 2 prefers LESS because it supports modular and scalable styling — making it easier to manage large designs like Flipkart or Amazon.

4. How do I test if my theme is responsive?

Use browser developer tools or tools like BrowserStack to test your theme across devices. Mobile-first design is critical in India’s mobile-heavy market.

Sanjay Modasia 96x96

Sanjay Modasia

Sanjay Modasia is Founder & Managing Director at LogicRays Technologies. He has spent the last six years bringing evolution in technology through serving his expertise in Web & App Development using top technological skills like Python/ Django Development, Artificial Intelligence & Machine Learning, Data Science, Vue JS, AngularJS, and React JS.Sanjay brings a new perspective with Web & App Development in every technology he comes by. With the help of his technical skills, he is bringing change by helping startups and businesses grow on a large scale. His management and technological abilities have greatly benefited the organisation.

Subscribe To Our

Newsletter

Know The Technology!

Sign up today!