cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a Child Theme in Magento 2

SOLVED

How to create a Child Theme in Magento 2

I want to modify certain aspects of the out-of-the-box Luma theme but I would like to do it by preserving the original file(s) and also ensuring that whenever I update Magento I preserve my changes as well.

 

I want to do this by way of a Child Theme.

 

Does Magento 2 support child themes and, if so, how do I structure my directory path to make this happen?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to create a Child Theme in Magento 2

Hi @sportame

 

You can create a child theme in Magento 2. You should use Luma  as parent theme.

Please refer following official documentation Create a theme

 

As per the link you should use following( mentioned under declare your theme section of documentation)

 

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
     <title>New theme</title> <!-- your theme's name -->
     <parent>Magento/luma</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
     <media>
         <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image -->
     </media>
 </theme>

 

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

View solution in original post

8 REPLIES 8

Re: How to create a Child Theme in Magento 2

Hi @sportame

 

You can create a child theme in Magento 2. You should use Luma  as parent theme.

Please refer following official documentation Create a theme

 

As per the link you should use following( mentioned under declare your theme section of documentation)

 

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
     <title>New theme</title> <!-- your theme's name -->
     <parent>Magento/luma</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
     <media>
         <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image -->
     </media>
 </theme>

 

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: How to create a Child Theme in Magento 2

I followed the instructions and got this error:

 

There has been an error processing your request

Exception printing is disabled by default for security reasons.

Error log record number: 704914686841

 

When I comment out the contents of the registration.php file, the error goes away

Re: How to create a Child Theme in Magento 2

Hi @sportame

 

Go to var/reports folder and open report number 704914686841.

It contains the error message based on that you have to debug.

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: How to create a Child Theme in Magento 2

HI, Just a note do not use luma as a parent theme, magento strongly advises against this as it is often changed during upgrade, always use another theme blank theme 

Re: How to create a Child Theme in Magento 2

See this video, this video will save your time.

 

How to create a child theme in magento 2

Re: How to create a Child Theme in Magento 2

hi PHPCuong, video is not available Smiley Sad

Re: How to create a Child Theme in Magento 2

The video link is updated, you can learn How to create a child theme in magento 2

Re: How to create a Child Theme in Magento 2

I'm having issue with child theme. After making changes in child theme by overriding the template. Those changes are not reflecting on pages. Even I've cleared all cache and run deploy command to get the updated source. I've followed the same instructions given by you. 
 
Can you please help me where could be the issue?