1

I have create a child theme that extends from magento-luma theme by following the steps below:

app/design/frontend/Company/parent/registration.php

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/Company/parent',
    __DIR__
);

app/design/frontend/Company/parent/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Parent Theme</title>
    <parent>Magento/luma</parent>
</theme>

app/design/frontend/Company/parent/web/css/source/_extend.less

body{
  background-color: red;
}

After activating this theme from from magento admin. it works fine, load parent luma styles , images and js perfectly. When I make another child theme that extends with the parent theme created above. It does not load the its parent themes styles and all other static assets.

I created the grand-child theme as follows.

app/design/frontend/Company/child/registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/Company/child',
    __DIR__
);

app/design/frontend/Company/child/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Child Theme</title>
    <parent>Company/parent</parent>
</theme>

app/design/frontend/Company/child/web/css/source/_extend.less

body{
  color: yellow;
}

This is the result that I see on the browser

  • do you run setup upgrade and static content deploy command after creating all above files ? – Dhaval Solanki Jul 17 '19 at 5:24
  • @Dhaval Solanki .Yes I run both commands but result is the same, _extend.less file is being override. – Alhayat Jul 17 '19 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.