Hello Magento Friends,

Today I will be explaining How to Create a Child Theme in Magento 2.

Before moving to the steps, first, let’s understand What a theme is in Magento 2 and Why you must create a child theme in Magento 2.

What is a Theme in Magento 2?

A theme is an important component of the Magento 2 store. It is a combination of styles, layout, templates, and images to give a consistent look and feel to the store.

Magento 2 by default provides two themes:

  1. Magento Blank
  2. Magento Luma

Learn – How to Change Theme In Magento 2

What is the Child Theme in Magento 2?

A child theme is the inheritance of a parent theme with all the properties. It helps to create customization as per the business requirements.

Why is it required to Create a Child Theme in Magento 2?

Sometimes it is required to add customization to the theme. The parent theme installed using composer is stored in the vendor directory. Updating those themes will replace the changes and we will not be able to update in the future. Creating a child theme is the option to get the customization done in a different folder as well as maintain the original theme.

Steps to Create a Child Theme in Magento 2:

Step 1: Create a child theme folder named luma_child in the following folder path: 

app\design\frontend\Vendor\luma_child

Step 2: Create theme.xml at the given below path

app\design\frontend\Vendor\luma_child\theme.xml

Now, add the code as follows

Step 3: Create registration.php at the following path

app\design\frontend\Vendor\luma_child\registration.php

Then, append the below-mentioned code

Step 4: Create composer.json at the given below path

app\design\frontend\Vendor\luma_child\composer.json

Add the following code

Conclusion:

Hence this way you can create a child theme in Magento 2. If you are unable to successfully create a child theme, let me know through the comment section.

Found this tutorial useful? Share with your friends and stay connected for more!

Happy Reading!

Click to rate this post!
[Total: 2 Average: 5]