LogoLogo
SearchService PortalManualOthersDeutschRequest support
  • Welcome
  • Knowledge Base
    • Introduction
      • Testing ThemeWare®
      • Installing ThemeWare®
      • Activating ThemeWare®
      • Assigning ThemeWare®
      • ThemeWare® Utilities downloaden
      • Überblick Theme-Konfiguration
      • ThemeWare® bearbeiten
      • Themes kombinieren
      • Farben konfigurieren
      • Schriften konfigurieren
      • Logo einbinden
      • Logo konfigurieren
      • Text-Logo konfigurieren
      • Shop-Navigation konfigurieren
      • Texte im Theme bearbeiten
      • USP-Bar konfigurieren
      • Erlebniswelten verstehen
      • ThemeWare® Demoshops
      • Setting up the home page (ThemeWare® Shopping Experience)
      • Design der Kategorie-Seite anpassen
      • Shopseiten bearbeiten und anlegen
      • Service-Navigation konfigurieren
      • Footer-Navigation konfigurieren
      • Footer konfigurieren
      • Zahlungs- und Versandanbieter Logos
      • Mehrsprachigkeit mit ThemeWare®
      • Mehr als ein ThemeWare® Theme nutzen
      • ThemeWare® erwerben
      • Getting support
      • Updates and news
    • Tutorials
      • Administration
        • Testing ThemeWare®
        • Buying ThemeWare®
        • Renting ThemeWare®
        • Uploading ThemeWare®
        • Installing ThemeWare®
        • Activating ThemeWare®
        • Assigning ThemeWare®
        • Editing ThemeWare®
        • Resetting ThemeWare®
        • Rating ThemeWare®
        • Updating ThemeWare®
        • Cleaning up ThemeWare®
        • Deactivating ThemeWare®
        • Uninstalling ThemeWare®
        • Deleting ThemeWare®
        • Returning ThemeWare®
        • Determining the ThemeWare® version
        • Shopware Updates and ThemeWare®
      • Categories
        • Assign a category layout
        • Cooking pleasure & Provence (Demoshop)
        • Craft & Tradition (Demoshop)
        • Create a category
        • Create a category layout
        • Create a category layout with sidebar
        • Make product boxes more compact
        • Make product listings more compact
        • Mountain air & Adventure (Demoshop)
      • Configuration
        • Child theme
        • Color configuration field
        • Field types in the theme configuration
        • Font configuration field
        • Using SCSS functions in the configuration
        • Using theme variables in the configuration
        • ThemeWare® duplicates
        • Creating a ThemeWare® duplicate
        • Renaming a ThemeWare® duplicate
        • Orphaned configuration fields
      • Custom Fields
      • Debugging
        • Identifying the extension as the cause of the error
        • Debugging error messages
        • Narrowing down errors
        • Identifying the theme as the cause of error
        • Debug mode
      • Demoshops
        • Home page
        • Category "Mountain air & Adventure"
        • Category "Cooking pleasure & Provence"
        • Category "Craft & Tradition"
        • Configuration
      • Fonts
        • Embedding fonts locally
        • Embedding fonts locally using the ThemeWare® Customizing Plugin
        • Font configuration
        • Importing Google Fonts
      • Header
        • Configuring the Shopping Experiences Header
      • Individual customizations
        • Individual customizations by means of CSS
        • Individual customizations by means of SCSS
        • Individual template customizations (Twig, HTML)
        • Individual customizations with the ThemeWare® Customizing Plugin
        • Individual customizations with the ThemeWare® Customizing App (Cloud)
        • Embed custom JavaScript code
        • CSS hierarchy
        • Using Bootstrap in the Storefront
        • Show custom fields in the storefront
      • Landing pages
        • Create a landing page
        • Create a landing page layout
        • Assign a landing page layout
        • Create a home page
      • Miscellaneous
        • Clearing / warming up the Shopware cache
        • Clearing the browser cache
        • Compiling the theme
        • Refreshing the storefront
      • Product pages
        • Create a product layout
        • Create a product layout with sidebar
        • Assign a product layout
      • Shop pages
        • Creating a shop page layout
        • Linking shop pages in the storefront
        • Creating a contact page
        • Creating a GTC page
        • Creating a newsletter page
        • Creating a payment and shipping information page
        • Creating a privacy page
        • Creating a revocation notices page
        • Creating an imprint page
      • Shopping Experiences
        • ThemeWare® CMS styling for Shopping Experiences
        • ThemeWare® CSS classes for Shopping Experiences
        • Adjusting column spacings in CMS blocks
        • Adjusting gaps in CMS blocks
        • CSS classes for full-width sections
        • CSS spacing classes for Shopping Experiences
        • Designing headlines in CMS blocks
        • Designing Shopping Experiences with Bootstrap CSS classes
        • Designing Shopping Experiences with Bootstrap HTML code
        • Embellishing images in CMS blocks
        • Embellishing images in CMS blocks with hover effects
        • Embellishing Shopping Experiences with CSS animations
        • Hide CMS blocks on mobile devices
        • Mark CMS blocks as favourites to find them faster
        • Mark CMS elements as favourites to find them faster
        • Recreating category Shopping Experiences of the demoshops
        • Responsive Shopping Experiences
        • Responsive Shopping Experiences with Bootstrap
        • Show custom fields in Shopping Experiences
      • Shopware Account
        • Renew ThemeWare® Subscription
        • Switch to rental license
      • Shopware Store
        • Finding ThemeWare®
        • Testing ThemeWare®
        • Buying ThemeWare®
        • Renting ThemeWare®
        • Purchasing ThemeWare® after the trial period
        • Renting ThemeWare® after the trial month
      • Solving errors
        • Examining extensions or plugins
        • Examining individual customizations
        • Examining Shopware default theme
        • Performing a ThemeWare® Soft Reset
        • Fixing representation errors
        • Reinstalling ThemeWare®
        • Solving known errors by yourself easily
        • Update the shop
      • Texts: Edit and translate
    • Basic knowledge
      • Update guide
      • Color configuration
      • Font configuration
      • HTML code
      • Identifying the current ThemeWare® Version
      • Images
        • Display mode of images
        • Image sizes
      • Licences
      • Payment methods
      • Plugin Compatibility (HC-Architecture®)
      • Shipping methods
      • Shopping Experiences
        • CMS layout
        • CMS section
        • CMS block
        • CMS element
      • Shopware Compatibility
      • Snippets
      • Supported browsers
      • ThemeWare® data
    • Profi knowledge
      • The ultimate Professional Knowledge
      • Backup of the ThemeWare® configuration
      • Backing up and restoring the ThemeWare® configuration
      • Column CSS classes in ThemeWare® CMS elements
      • Deactivating ThemeWare® via the database
      • Debug mode
      • Editing the database with the Adminer
      • Establishing compatibility with ThemeWare® for Shopware 6
      • Expert mode
      • Expert settings in CMS elements
      • Expert settings in the theme configuration
      • Exporting and importing the ThemeWare® configuration
      • HTML Sanitizer
      • Installing ThemeWare® manually
      • Optimizing Shopping Experiences with Bootstrap CSS classes
      • Optimizing Shopping Experiences with Bootstrap HTML elements
      • Resetting the ThemeWare® configuration
      • SCSS
      • ThemeWare® in the database
      • ThemeWare® on the FTP server
      • Twig
      • Updating ThemeWare® manually
      • Uploading ThemeWare® via FTP
      • Using Bootstrap CSS classes
      • Using Bootstrap HTML code
    • Frequent questions
      • Frequently searched features in ThemeWare®
      • Can I extend the trial month?
      • Can I extend the trial period?
      • Do I have to purchase ThemeWare® again for another domain?
      • Do I have to purchase ThemeWare® again for another Sales Channel?
      • How can I change or translate a text (e.g. of widgets)?
      • How can I change the number of levels in the flyout?
      • How can I embed Google Fonts in a GDPR compliant manner locally?
      • How do I cancel a extension rent?
      • How can I customise snippets for individual Sales Channels?
      • How can I customise texts for individual Sales Channels?
      • How can I fix representation errors?
      • How can I hide CMS blocks on mobile devices?
      • How can I hide the product description in product boxes?
      • How can I make individual customisations?
      • How can I make the listing look more compact?
      • How can I make product boxes more compact?
      • How can I remove the border around a CMS block?
      • How can I remove the borders around CMS blocks?
      • How can I remove the spaces in the listing?
      • How can I use a different configuration for a Sales Channel?
      • How can I use an individual configuration for an additional Sales Channel?
      • How do I configure the autoplay in the image slider?
      • How do I use webfonts in a GDPR compliant manner?
      • How to delete licences correctly?
      • The subscription expires - what now?
      • What does "Already compatible" mean?
      • What does "Not compatible" mean?
      • What does "Now avaiable" mean?
      • What does "With new Shopware version" mean?
      • What does the "Extension Warning" window mean when opening my admin?
      • What image sizes should I use with ThemeWare®?
      • When does the trial month end?
      • When does the trial period end?
      • Why does the header overlay the Shopping Experience?
      • Why does the subscription have to be renewed for bought extensions?
      • Why is the new ThemeWare® version not available?
      • Why is ThemeWare® available several times in the Shopware store?
    • Common issues
      • Storefront
        • Branding is shown despite Licence Key
        • CMS blocks are not displayed in Shopping Experience
        • Gallery sliders have a wrong height on mobile devices
        • Header overlays the Shopping Experience on the home page
        • Listing subcategories are not displayed
        • Oops! An Error Occurred
        • Pop-up (e.g. privacy) is displayed without content
        • Privacy pop-up is displayed without content
        • Representation errors in the storefront
        • Representation errors with a theme duplicate after an update
        • Shipping costs pop-up is displayed without content
        • Sticky top navigation does not work
        • T&C pop-up is displayed without content
        • Unfortunately something went wrong on the product page
      • Administration
        • Administration not accessible
        • Allowed memory size of ... bytes exhausted
        • Bad Request...
        • $color: 0 is not a color
        • $color2: 0 is not a color
        • Configuration fields are missing
        • Configuration fields in the "General" tab
        • Configuration required. Please fill in data in all elements.
        • Error 400 / Theme cannot be saved
        • Error 500 / Themes cannot be saved
        • Error: argument '$color'
        • Error compiling theme
        • Errors occurred. Please check the error list in the editor.
        • Features or configurations are missing
        • New configuration fields are missing in a theme duplicate after update
        • Parse error: failed at $...
        • Preview images in the Shopping Experience editor show placeholder images
        • Saving the theme configuration takes a very long time
        • Simplified representation of the theme configuration
        • Some blocks were not configured sufficiently
        • Theme could not be assigned to sales channel
        • ThemeWare® cannot be updated
        • ThemeWare® update not available
        • Unable to compile theme
        • Unable to compile the theme...
        • Unable to deactivate or uninstall theme
        • Unable to find the theme
        • Undefined variable $...
    • Tips and tricks
      • Image optimization
      • Logo design tips
      • Recommended Extensions or Plugins
      • Technical terms explained
      • The top 10 tips
      • Useful Links
      • Ideales Vorgehen bei der Konfiguration
      • Konfigurationsfelder schnell finden
      • Wie du jede Farbe im Theme Manager findest
    • Shopware
      • Getting Started
        • System Requirements
      • Migration
      • Configuration
        • Shopping Experiences
          • Inserting images into text fields
        • Themes
          • Assign Shopware default theme
        • Extensions
          • Activate extensions
          • Deactivate extensions
          • Install extensions
          • Install extensions manually
          • Purchase extensions
          • Rate extensions
          • Remove extensions
          • Rent extensions
          • Return extensions
          • Uninstall extensions
          • Update extensions
          • Update extensions manually
        • Sales channel
          • Maintenance mode
        • Settings
          • Caches & Indexes
      • Cloud
      • Shopware Extensions
      • Tutorials
      • Update Guides
      • Support
      • Shopware Account
        • Linking up the Shopware Account with the shop
        • Moving Licenses in the Shopware Account to a different Domain
        • Registering the Shopware Account in the administration
        • Rename shop domain
        • Setting up the shop in the Shopware Account
        • Transfer licenses
  • More knowledge
    • ThemeWare® Extras
    • ThemeWare® Tools
      • ThemeWare® Customizing Plugin
      • ThemeWare® Customizing App (Cloud)
      • ThemeWare® Shopping Experiences Import (Plugin)
    • Lexicon
    • Accessibility
    • SEO & Pagespeed
      • PageSpeed Insights
  • Others
    • About ThemeWare®
    • ThemeWare® Demoshops
    • ThemeWare® Manual
    • ThemeWare® Video Tutorial
    • ThemeWare® Utilities
    • 🇩🇪Deutsch
Powered by GitBook
On this page
  • Introduction
  • Viewing the source code
  • Finding the appropriate template file
  • Integrating template customizations (for experienced users)
  • Helpful Twig Basics
  • Deriving a template file
  • Add content to Twig block
  • Overwriting Twig block
  • Displaying all variables
  • Including text snippets
  • Outputting custom fields in the storefront
  • Querying a ThemeWare® variable
  • Outputting a ThemeWare® variable
  • Additional ThemeWare® knowledge
  • Finding ThemeWare® variables
  • Delimitation for ThemeWare® customizations

Was this helpful?

  1. Knowledge Base
  2. Tutorials
  3. Individual customizations

Individual template customizations (Twig, HTML)

In this article you will learn how to perform individual template customizations using the "ThemeWare® Customizing Plugin".

PreviousIndividual customizations by means of SCSSNextIndividual customizations with the ThemeWare® Customizing Plugin

Last updated 3 months ago

Was this helpful?

LogoLogo

ThemeWare®

  • About ThemeWare®
  • ThemeWare® Demoshops
  • ThemeWare® Service Portal
  • ThemeWare® Utilities

Informations

  • Legal notice
  • Newsletter
  • Privacy
  • Support

© 2024 by ThemeWare® | Made with 💙 by TC-Innovations GmbH

In case you want to change the appearance of ThemeWare® individually by means of a template customization, you will find useful tips for working with template files in this article.

Tip: Creating a ThemeWare® duplicate is not necessary for template customizations.


Introduction

For individual template customizations in Shopware 6 you need an own theme or a separate extension (plugin or app) and not – as in Shopware 5 – a theme derivative.

  • Check whether there already is a suitable extension in the

  • Alternatively, you may use the manual method using our "ThemeWare® Customizing Plugin" or the "ThemeWare® Customizing App" (see section "Integrating template customizations (for experienced users)").


Viewing the source code

The basic structure (folders, template files, Twig blocks, etc.) is given by the Shopware theme, "" since ThemeWare® is technically an "extension" of it.

Note: Currently there is no possibility to view files of extensions (plugins, apps or themes) in the Shopware Cloud.

Attention: Do Never edit original files of Shopware or any extensions (plugins, apps or themes)!

ThemeWare® Pro Edition

custom/plugins/TcinnThemeWareXYZ/src/Resources/views
custom/plugins/TcinnThemeWareXYZ/src/Resources/views/themeware

ThemeWare® Cloud Edition

custom/apps/TcinnThemeWareXYZApp/Resources/views/storefront
custom/apps/TcinnThemeWareXYZApp/Resources/views/storefront/themeware

ThemeWare® only derives the necessary template files within the scope of our HC-Architecture® and adds for its own functions and features (e.g. widgets) its own template files.

Finding the appropriate template file

When looking for a specific place in the templates, you can use e.g. the inspector of your browser to find a CSS class which is located at the corresponding element or at least in the immediate vicinity of the corresponding element.

Example

For example, if you want to add something below the product description, take a closer look at the HTML code of the description:

...
<div class="product-detail-description tab-pane-container">
        <h2 class="product-detail-description-title">
                Product information "Main product with reviews"
        </h2>
        
        <div class="product-detail-description-text" itemprop="description">
                Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
        </div>       
</div>
...

The description is surrounded by a <div> with the class product-detail-description-text.

A look at the source code of this file shows that the <div> with the product-detail-description-text class is located in the Twig block component_product_description_content_text.

...
{% block component_product_description_content_text %}
    <div class="product-detail-description-text"
         itemprop="description">
        {{ product.translated.description|raw }}
    </div>
{% endblock %}
...

So derive the file description.html.twig for your template customisation and extend the Twig block component_product_description_content_text.

Further information on deriving and extending template files can be found below.


Integrating template customizations (for experienced users)

Currently, Shopware 6 lacks a full-fledged child theme that allows you to include files and make changes (like Shopware 5). As a workaround, we have developed a small free "ThemeWare® Customizing Plugin" or "ThemeWare® Customizing App" for integrating individual customizations and your own files.

All information about the extensions, installation and download links can be found in the following articles:


Helpful Twig Basics

Shopware 6 uses Twig as template engine and no longer Smarty as used in Shopware 5. However, many things are the same or at least very similar in TwigIn order to give you a rough overview of Twig, we have briefly summarized the most important information in the following.

Deriving a template file

In the first line of the file it has to be defined from which superior file it is derived.

{% sw_extends '@Storefront/storefront/page/product-detail/headline.html.twig' %}

Deriving a ThemeWare® template file

{% sw_extends '@Storefront/storefront/themeware/extensions/twt-hero-section.html.twig' %}

Add content to Twig block

In order to place your own content in front of or behind the actual content of the block, you do not have to copy the entire code of the block. You can use the parent command as follows:

Add content after the original content of the block:

{% block name_of_the block %}
  {{ parent() }}

  {# Place new content here #}
{% endblock %}

Add content before the original content of the block:

{% block name_of_the block %}
  {# Place new content here #}

  {{ parent() }}
{% endblock %}

Overwriting Twig block

In case you want to replace the original content of the block completely, you can omit the parent command to empty the block.

{% block page_product_detail_name_container %}
  {# Place new content here #}
{% endblock %}

Displaying all variables

{{ dump() }}

Including text snippets

The name of the desired snippet is available in the snippet management of your administration ("Settings" => "Shop" => "Snippets").

In order that the translations of the individual snippets are being considered, use the addition |trans.

{% block name_of_the block %}
  {{ parent() }}
  
  {{ "twt.widget.communities.headline"|trans }}
{% endblock %}

Outputting custom fields in the storefront

An additional field at the product level is output as follows:

{{ page.product.translated.customFields.technischer_name_zusatzfeld }}

An additional field for categories will be output as follows:

{{ page.footer.navigation.active.translated.customFields.technischer_name_zusatzfeld }}

Querying a ThemeWare® variable

The query of a theme variable (e.g. the ThemeWare® configuration "Body class") in a Twig block works as follows:

{% if theme_config('twt-body-class') %}
    ...
{% endif %}

Outputting a ThemeWare® variable

The output of a theme variable must also take place in a Twig block. The following example shows the ThemeWare® configuration "Body class" (Tab "Others" => Block "Expert settings" => Section "Individual CSS class" => Field "Body class").

{{ theme_config('twt-body-class') }}

Additional ThemeWare® knowledge

Finding ThemeWare® variables

Delimitation for ThemeWare® customizations

In case a template customization is only relevant for a certain sales channel, you have the possibility to limit your customization for example via the ThemeWare® configuration with the "Body class".

For this purpose, enter a unique name for this sales channel (e.g. myshopname) in the theme duplicate for the corresponding sales channel using Tab "Others" => Block "Expert settings" => Section "Individual CSS class" => Field "Body class".

This name can then be used for Twig in an additional loop.

{# Customization only for theme with the body class "myshopname". #}

{% if theme_config('twt-body-class') == "meinshopname" %}
  {# Theme has body class "myshopname" #}
  ...
  {{ parent() }}
{% else %}
  {# Theme does not have body class "myshopname" #}
  {{ parent() }}
{% endif %}

Alternatively, you may also bind your customization to the ID of the sales channel:

{# Customization for a sales channel with the ID "..." #}

{% if context.salesChannel.id == "..." %}
  {# Sales channel has the ID "..." #}
  ...
  {{ parent() }}
{% else %}
  {# Sales channel does not have the ID "..." #}
  {{ parent() }}
{% endif %}

In addition, please find the source code of the Shopware default theme on . The folder "views/storefront" contains all template files which are relevant for the storefront.

Now you can search for this CSS class in the . In most cases a suitable template file will be found quite soon.

We search in the Git repository for this CSS class and find the file description.html.twig (see ).

Note: Advanced links concerning the topic "Twig", please find in the Twig documentation:

The output of all variables available on the page can be obtained with the dump command. The output has to be in a block and is only available in

Note: More information about custom fields are available in the .

Our provides you with the opportunity to have all ThemeWare® variables displayed. The "technical name" in this overview is the name of the corresponding variable you can use in Twig or SCSS.

Shopware Community Store
Shopware default theme
GitHub
Shopware Git repository
GitHub
Individual customizations with the ThemeWare® Customizing Plugin
Individual customizations with the ThemeWare® Customizing App (Cloud)
https://twig.symfony.com
developer mode
Shopware-Documentation
ThemeWare® Config Finder