How can I override phtml, XML and CSS files that are overridden or created in custom theme.
1 Answer
You can achieve this via creating a new child theme.
like below:
suppose this is your current theme:
app\design\frontend\your_namespace\your_customtheme
Copy your current theme in same directory like below:
Now you have to update your code in theme.xml
It should like:
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Custom child theme</title>
<parent>your_parent_namespace/your_parent_theme</parent>
<media>
<preview_image>media/preview.jpg</preview_image>
</media>
</theme>
Make sure you have to give your current theme name as a parent in newly created child theme.
-
I already have a custom paid theme, But I want to override theme templates, so if I am going to update it will not affect my changes– YogitaJun 29, 2019 at 8:09
-
-
Like you have already one theme like app\design\frontend\your_namespace\your_customtheme\Magento_Catalog\templates\product\list.phtml and you want to override your custom theme template ? Jun 29, 2019 at 8:12
-
@RaviSoni, Yes I already have theme and want to override template of theme and some of things that is override by theme.– YogitaJun 29, 2019 at 8:35
-
For that you have to create one child theme. And you can assign your current theme as a parent. That's only way. Jun 29, 2019 at 8:49