Magento 2 Experten — Hyvä Theme, Tailwind CSS & SEO aus einer Hand ›

Overriding Templates: Theme Fallback Conventions

Overriding Templates: Theme Fallback Conventions

~6 Min. Lesezeit Zuletzt aktualisiert am August 9, 2026

Sometimes a custom module isn't enough - you want to specifically adjust an existing Hyvä or Magento default template, without touching the core. That's what Magento's theme fallback mechanism is for, and it applies unchanged in Hyvä projects too.

How the fallback works

Magento looks for a template in this order, until it finds one:

  1. in the active theme, in the matching module subfolder (app/design/frontend/Mironsoft/default/[Module]/templates/...)
  2. in the active theme's parent theme (i.e. in the Hyvä CSP theme itself)
  3. in the module that originally defines the template (app/code/.../view/frontend/templates/...)

If a template is placed in the child theme under the exact same relative path as in the module or parent theme, the child theme version wins automatically - without configuring "override" explicitly anywhere.

Example: adjusting the mini cart

Say Hyvä's default mini cart template lives (simplified) at Magento_Checkout/templates/cart/minicart.phtml in the parent theme. To customize it, you create the exact same relative path structure in your own child theme:

Template override in the child theme

app/design/frontend/Mironsoft/default/
└── Magento_Checkout/
    └── templates/
        └── cart/
            └── minicart.phtml   ← overrides the Hyvä version

The module folder name (Magento_Checkout) and the path after it must match exactly - even a small typo means Magento keeps using the original template, without reporting an error.

Achtung: An overridden template freezes the original template's state at the moment it was copied. If the Hyvä parent theme is later updated and the original template changes (new CSP registration, a bugfix, new accessibility attributes), your own copy stays unchanged - you have to manually port those updates over. Use overrides sparingly.

Alternative: referenceBlock instead of a full copy

Not every adjustment needs a full template copy. If you only want to change one argument or remove a block, a <referenceBlock> in the Layout XML (see chapter 6) is often enough - without touching the actual PHP template file at all. That's the lower-maintenance solution and should be preferred wherever possible.

Tipp: Rule of thumb: first check whether Layout XML (changing arguments, moving/removing blocks) gets you the result you want. Only once the HTML structure or PHP logic inside the template itself genuinely needs to change is a full template copy worth it.