0

How can I override phtml, XML and CSS files that are overridden or created in custom theme.

1 Answer 1

0

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.

7
  • 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
    – Yogita
    Commented Jun 29, 2019 at 8:09
  • override theme template using custom module ?? Commented Jun 29, 2019 at 8:11
  • 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 ?
    – Ravi Soni
    Commented 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.
    – Yogita
    Commented Jun 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.
    – Ravi Soni
    Commented Jun 29, 2019 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.