The Shopware 6 storefront is based on the Bootstrap framework, and thanks to its HC-Architecture® ThemeWare® is fully compatible with it. You can therefore insert ready-made Bootstrap elements such as buttons or alerts as HTML code into a text element, without writing your own CSS.
Tip: You can find examples of use in our demo shops on the pages "Bootstrap examples".
Inserting HTML code
- In the administration, open "Content" => "Shopping Experiences" and your layout
- Add a block with a text element or click on an existing text element
- In the toolbar of the editor, switch to the HTML view via the "</>" icon
- Insert the HTML code
- Switch back to the normal view and save the layout
Important: The HTML editor of Shopware sanitises the code when saving and removes tags and attributes it does not allow. The examples on this page only use tags and attributes that are allowed in the default setting of Shopware. More information: HTML Sanitizer
Examples
Button
A link that looks like a button. With btn-primary it gets your primary colour, with btn-outline-primary only a border, and btn-lg makes it larger.
<a href="https://service.themeware.design/New-arrivals/" class="btn btn-primary">Discover new arrivals</a>
<a href="https://service.themeware.design/Sale/" class="btn btn-outline-primary btn-lg">Go to sale</a>
Alert
A box with a coloured background for notes. You get further colours with alert-success, alert-warning and alert-danger.
<div class="alert alert-info">
<strong>Note:</strong> We ship orders placed before 2 pm on the same day.
</div>
Badge
A small label, for example next to a headline.
<h2>Winter coats <span class="badge bg-primary">New</span></h2>
List
A list with dividing lines, for example for benefits.
<ul class="list-group list-group-flush">
<li class="list-group-item">Free shipping from 50 €</li>
<li class="list-group-item">30-day return policy</li>
<li class="list-group-item">Personal advice</li>
</ul>
Two columns
With the Bootstrap grid you split the content of a text element into columns. On smartphones the columns are stacked, from tablet size they are side by side.
<div class="row">
<div class="col-md-6">
<h3>Material</h3>
<p>100 % organic cotton</p>
</div>
<div class="col-md-6">
<h3>Care</h3>
<p>Washable at 30 degrees</p>
</div>
</div>
Which Bootstrap version?
| Shopware | Bootstrap |
|---|---|
| 6.4 | Bootstrap 4 |
| 6.5 and newer | Bootstrap 5 |
The examples on this page apply to Bootstrap 5.
If the editor changes your code
- Check whether your code contains tags or attributes that the HTML sanitizer removes: HTML Sanitizer
- For elements with their own behaviour such as modals or accordions you find examples in the article Optimizing Shopping Experiences with Bootstrap HTML elements
- The ThemeWare® CMS element "Custom code (HTML/CSS/JS)" gives you more freedom, as it does not sanitise your code (Pro Edition): Custom code (HTML/CSS/JS)