cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a Child Theme in Magento 2

SOLVED
Frequent Contributor

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?

  • magento2
4 REPLIES
Moderator

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 ClickAccept as Solution!:Magento Community India Forum
Frequent Contributor

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

Moderator

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 ClickAccept as Solution!:Magento Community India Forum
Highlighted
Senior Member

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