Meet Us at Dubai - Gitex Global 2023 For The Exponential Growth Of Your Business!! Schedule a Meeting.

How to create a child theme in Hyva Magento 2

Written by Mayur patel

Apr 06, 2023

How to create a child theme in Hyva Magento 2

In this blog post, we will discuss how to create a child theme in Hyva Magento 2.
It is important to create a child theme in Magento 2 as mentioned below.
Custom themes are built from the ground up. Although it might appear time-consuming, these themes consistently produce good results in terms of conversions and user engagement.
There are 2 methods to create a custom theme in Hyva Magento 2 which are mentioned below.

  • Child theme
  • Duplicate the hyva-themes/magento2-default-theme and modify it

How to decide whether to use a duplicate or a child theme.
Most likely, you should begin with the child theme method. The more flexible and straightforward method is this one.
You might wish to choose the duplicate theme strategy if you are really experienced with Hyvä and Magento development and want to fully alter and optimize your Hyvä Theme.

Method 1 : Child theme
Here are the steps to create a child theme in Hyva Magento 2:

Step 1 : Creating a Magento theme folder
Creating a folder for the theme:

  • Go to app/design/frontend
  • Creating a vendor folder app/design/frontend/ e.g: app/design/frontend/Dolphin
  • Create a theme folder app/design/frontend// e.g: app/design/frontend/Dolphin/default
├── Dolphin/
│   │   ├──default/
│   │   │   ├── ...
│   │   │   ├── ...

Step 2 : Declare your theme
We now have the folder app/design/frontend/Dolphin/default; make a file called theme.xml that defines the theme’s fundamental information, such as: Name, parent theme (in case your theme inherits from an existing theme)


<theme xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Hyvachild theme</title> <!-- your theme's name -->
    <parent>Hyva/default</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
        <preview_image>media/preview.png</preview_image> <!-- the path to your theme's preview image -->

Ensure that your child theme app/design/frontend/Dolphin/default/media has a copy of the web directory from the parent theme

Step 3 : Register theme
To register the theme with Magento 2, you can include the following content.
We must create a registration.php file and place it in the theme folder’s root directory in order to register the theme with the Magento 2.


 * Copyright (c) 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
); ?>

Step 4 : copy web folder
Ensure that your child theme app/design/frontend/Dolphin/default/web has a copy of the web directory from the parent theme

Step 5 : Configure the parent theme
In the web/tailwind/tailwind.config.js file of your child theme, you must set the parent theme path.

For instance, if your child theme’s tailwind.config.js file is located in vendor/design/frontend/Dolphin/default/web/tailwind, enable the line following the comment/parent theme to set the parent theme (if this is a child-theme)

module.exports = {
 // keep the original settings from tailwind.config.js
 // only add the path below to the purge > content settings
 content: [
    // this theme's phtml and layout XML files
    // parent theme in Vendor (if this is a child-theme)
    // app/code phtml files (if need tailwind classes from app/code modules)

Step 6 : Generate style.css for child theme
Be aware that you must regenerate your theme’s styles.css file after making changes to your theme.
You can regenerate your theme’s styles.css as per the given instruction in the following link.

Step 7 :  Apply child theme

m image3

Choose your child theme, Hyvachild theme, from the dropdown menu under Content->Design->Configuration on the admin dashboard, then save it.

m image1

Note: Run the following command
php bin/magento cache:clean
m image2

Mayur patel


We can help you with

  • Dedicated Team
  • Setup Extended Team
  • Product Development
  • Custom App Development

Schedule a Developer Interview And Get 7 Days Risk-Free Trial

Fill out This Form and one of Our Technical Experts will Contact you Within 12 Hours.

    Copyright © 2023 DOLPHIN WEB SOLUTION. All rights reserved.

    TO TOP