This page is aimed at developers of extensions (plugins and apps) for Shopware 6. It describes what to keep in mind so that your extension works together with ThemeWare® - and what ThemeWare® does on its side.
Note: Thanks to the ThemeWare® HC-Architecture®, almost all ThemeWare® extensions of the Shopware standard can be reset to the Shopware appearance in the theme configuration. In case of a conflict, this is usually the fastest way for the shop owner.
The most important rule: pass blocks on with parent()
ThemeWare® hooks into the Twig blocks of the Shopware Storefront. If your extension overrides one of these blocks without bringing back the original content, everything a theme has added there disappears - without any error message.
Therefore always include the original content with {{ parent() }} and add your own content before or after it:
{% sw_extends '@Storefront/storefront/layout/header/top-bar.html.twig' %}
{% block layout_header_top_bar_inner %}
{{ parent() }}
{# your own content #}
{% endblock %}
Replacing a block entirely does not only affect ThemeWare®: every theme that extends the same block loses its content there.
Special case: top bar
A well-known example is the top bar in the header. Some extensions replace the block layout_header_top_bar_inner there entirely - Shopware Commercial does so from version 7.13 on for the B2B context switcher. Hotline, service menu and the ThemeWare® styling of the bar are lost.
For this case ThemeWare® ships a dedicated compatibility mode. The shop owner switches it on in the theme configuration:
"Others" => "Compatibility (HC-Architecture®)" => "Header" => "Top bar" => ThemeWare® (plugin compatible)
ThemeWare® then catches the content of the extension and embeds it into its own top bar instead of dropping it. Your extension does not have to do anything for this - it is still better not to replace the block in the first place.
Tip: You are developing an extension and are not sure whether it works with ThemeWare®? Feel free to contact our support.