---
title: Theme configuration | Shopware Community Hub
description: >-
  Master the art of theme configuration in Shopware to create visually appealing
  and functional storefronts. This unit explores the technical stack behind…
canonical_url: 'https://hub.shopware.com/learn/unit/solutions-architect-theme-configuration'
---

# Theme configuration

<LearningObjectives>

- Understand the **concept of themes** in Shopware from a Solutions Architect perspective.
- Evaluate and select an **appropriate theme** for a project based on functionality, performance, and customization needs.
- Recognize the **relevance** of theme configuration options.
- Gain insights into the **technical stack** that underpins themes in Shopware.

</LearningObjectives>

# Understanding the Concept of Themes

In Shopware, themes are a foundational element for creating a coupled frontend that is fully compatible with all extensions in the Shopware ecosystem and allows for rapid development.

Themes in Shopware are more than just visual styling; they are a way to structure the entire frontend of your ecommerce site as well as make it configurable.

## Selecting the Right Theme

When selecting a theme, it's crucial to consider both the visual and functional aspects. Here's what to keep in mind:

- **Shopware-Developed Themes**: We generally recommend starting with a theme developed by Shopware. These themes are often lightweight and provide an excellent foundation for further customization by an agency. They are also typically well-optimized for performance and are designed to be compatible with the core Shopware functionalities and extensions. Some of these themes come bundled in Shopware, while others might be available under specific licenses.

- **Third-Party Themes**: The Shopware marketplace offers a variety of themes created by third-party developers. While these themes can be visually appealing and offer a range of functionalities, it's important to carefully evaluate them before making a purchase. Many third-party themes come prepackaged with additional functionalities and extensions. While this can be beneficial, it can also lead to code bloat, potentially impacting performance. Therefore, it's essential to ensure that the theme not only looks good but also aligns with the specific functional needs of your project.

## Customization and Maintenance Considerations

One critical piece of advice from experience is to avoid extensively modifying a purchased theme. This is because once you begin making significant modifications, the theme may lose its backward compatibility with future updates, making maintenance and upgrades more challenging. If a third-party theme requires extensive customization to meet your needs, it might be more prudent to consider developing a [custom theme](https://developer.shopware.com/docs/guides/plugins/themes/create-a-theme.html) instead.

For projects with tight budgets and deadlines, pre-bought themes offer a quicker and more cost-effective solution. However, for long-term projects where full control over the tech stack is desired, agencies often opt to build their own white-label themes. These custom themes can then be adapted more quickly for various clients while maintaining complete control over the development process.

## Theme Configuration Options

Another significant advantage of using themes in Shopware is the extensive configuration options they typically offer. These options allow for customization without the need for deep technical knowledge or development work. Common configuration options include:

- **Layout Settings**: Control how different pages are structured and displayed.

- **Color Schemes**: Ability to change the colors of various elements, such as buttons, headers, and backgrounds, to match your brand's identity.

- **Font and Typography**: Options to customize font types, sizes, and styles to create a cohesive look and feel.

- **Feature Flags**: Some themes come prepackaged with various functionalities that can be enabled or disabled through feature flags.

- **Content Blocks and Widgets**: Predefined content blocks or widgets that can be arranged and customized to suit the storefront's specific needs.

These configuration options are highly beneficial as they allow teams to make significant visual adjustments without altering the theme's codebase. When evaluating a theme, it's important to consider the range and flexibility of these configuration options, as they can greatly reduce the need for custom development.

## The Tech Stack Behind Themes

### Themes as Extensions

Themes in Shopware are essentially app or plugin extensions that are primarily comprised of Twig files. Twig is a flexible, fast, and secure templating engine for PHP that comes prepackaged with Symfony, the PHP framework that Shopware is built upon. Shopware has extended the capabilities of Twig by adding custom filters, functions, and global variables to make theme development more intuitive and aligned with the needs of ecommerce.

### <img align="left" src="../../assets/images/twig.png" width="50"/>  &nbsp; Twig Templating Engine

The Twig templating engine is at the heart of Shopware's theming system. It allows developers to create reusable templates for rendering HTML, making maintaining and updating the frontend easier.

Here are a few key elements of how Twig is used in Shopware themes:

- **Context**: In Twig, the context holds all the information that is passed to the template. In Shopware, this context typically includes vital information about the current page, such as the active product, category, or CMS content. For example, if a product detail page is being rendered, the context will include all relevant data about that product, such as its name, price, description, and images. This context-driven approach allows templates to be highly dynamic and adaptable to different pages and content types.

- **Custom Filters and Functions**: Shopware has added several custom Twig filters and functions to enhance the theming process. For instance, there are filters for formatting prices, rendering media files, and generating URLs based on the routing system. These extensions make it easier to implement common ecommerce functionalities without writing complex code.

For more detailed information about Twig and templating in Shopware, refer to the [Shopware Developer Documentation on Templating and Theming](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/customize-templates.html).

### <img align="left" src="../../assets/images/CSS3.png" width="30"/> &nbsp; Cascading Style Sheets

CSS plays a crucial role in customizing and styling Shopware themes. Here's how CSS is typically used:

- **Styling Components**: CSS is used to define the look and feel of various components like headers, footers, buttons, product listings, and forms.

  ```css
  .header {
      background-color: #f8f9fa;
      padding: 20px;
  }
  .product-list {
      display: flex;
      flex-wrap: wrap;
      gap: 15px;
  }
  ```  

- **SASS/LESS**: Shopware supports CSS preprocessors like SASS (Syntactically Awesome Style Sheets) and LESS (Leaner Style Sheets) to write more maintainable and modular CSS.

  ```scss
  $primary-color: #3498db;
  .button {
      background-color: $primary-color;
      color: #fff;
      &:hover {
          background-color: darken($primary-color, 10%);
      }
  }
  ```

- **Media Queries**: CSS media queries are used to create responsive designs that adapt to different screen sizes.

  ```css
  @media (max-width: 768px) {
      .product-list {
          flex-direction: column;
      }
  }
  ```

- **Twig and CSS**: Shopware uses Twig as its templating engine. You can include custom CSS files in your Twig templates.

  ```html
  {% block base_styles %}
      {{ parent() }}
      <link rel="stylesheet" href="{{ asset('bundles/storefront/css/custom.css') }}">
  {% endblock %}
  ```

Here's a typical structure for the CSS files in a Shopware theme:

```text
<theme root>/src/Resources/app/storefront/src/scss
.
├── composer.json  
└── src  
    ├── Resources  
    │   ├── app  
    │   │   └── storefront  
    │   │       └── src  
    │   │           └── scss  
    │   │               └── base.scss <-- SCSS entry  
    └── SwagBasicExampleTheme.php   
```

By organizing and writing efficient CSS, you can significantly enhance the visual appeal and usability of your Shopware theme.

### <img align="left" src="../../assets/images/js.png" width="30"/> &nbsp; Javascript

Shopware themes primarily use vanilla JavaScript (ES6). However, developers can integrate various JavaScript libraries and frameworks to enhance functionality and interactivity.
Here's how it's typically used:

- **Create JS plugins**: Storefront JavaScript plugins are vanilla JavaScript ES6 classes that extend from the Shopware Plugin base class. For more information, refer to [Writing a JavaScript plugin](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/add-custom-javascript.html#writing-a-javascript-plugin)

  ```js
  const { PluginBaseClass } = window;
  export default class ExamplePlugin extends PluginBaseClass {
  }
  ```

- **Interactive Elements**: JavaScript is used to create interactive elements like sliders, modals, accordions, and dropdowns.

- **AJAX Calls**: Through AJAX (Asynchronous JavaScript and XML), JavaScript enables seamless data fetching without reloading the page. This is crucial for features like adding products to the cart or filtering products.

- **Event Handling**: JavaScript handles user actions such as clicks, hovers, and form submissions to create a responsive interface. On top of that, Shopware publishes JS events which you can use to extend the default behavior. For more information, refer to [Reacting to JavaScript Events on Storefront](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/reacting-to-javascript-events.html)  

 Some commonly used frameworks and libraries include:

- <img src="../../assets/images/Vue.js.png" width="30"/> Vue.js: A progressive framework for building user interfaces. It's often used for creating dynamic and reactive components. BY default, Vue.js is used in administration. From Shopware 6.6 and upwards, administration uses Vue.js 3. On previous versions Vue.js 2 is used.

  You can read more about this here [Vue 3 upgrade](https://developer.shopware.com/docs/guides/upgrades-migrations/administration/vue3.html).

- <img src="../../assets/images/jQuery.png" width="30"/> jQuery: A fast, small, and feature-rich JavaScript library that simplifies HTML document traversal, event handling, and animation. This library was included by default in Shopware until version 6.5.

Here's a typical structure for JavaScript files in a Shopware theme:

```text
src/Resources/app/storefront/src/  
.
├── composer.json  
└── src  
    ├── Resources  
    │   ├── app  
    │   │   └── storefront  
    │   │       └── src  
    │   │           └── main.js <-- JS entry  
    └── SwagBasicExampleTheme.php  
```

### <img align="left" src="../../assets/images/bootstrap.png" width="40"/> &nbsp; Bootstrap

Shopware themes leverage Bootstrap, a popular HTML, CSS, and JavaScript library, to create responsive and visually appealing storefronts. Here's how Bootstrap is used in Shopware themes:

- **Base Framework**: The Shopware storefront is built on top of Bootstrap, utilizing its grid system, components, and utilities to structure and style the theme.

- **Customization**: Developers can override Bootstrap variables and styles to customize the appearance of the storefront. This is done by modifying SCSS variables in the theme's overrides.scss file.

- **Responsive Design**: Bootstrap's responsive design features ensure that the storefront looks good on all devices, from smartphones to tablets to desktops.

- **CSS Classes**: Bootstrap provides a wide range of CSS classes that can be applied to HTML elements to control layout, typography, colors, and more.

#### Using Bootstrap Classes

You can use Bootstrap classes directly in your Twig templates to style elements. For example:

```html
<div class="container">
    <h1 class="text-center">Welcome to My Shop</h1>
    <p class="text-primary">This is a primary text color.</p>
    <button class="btn btn-primary">Click Me</button>
</div>
```

#### Compatibility

Shopware 6.4 uses Bootstrap 4, while Shopware 6.5 and later versions use Bootstrap 5. This means some class names and features may differ between versions.
By leveraging Bootstrap, Shopware themes can be easily customized and made responsive, ensuring a great user experience across all devices.
More information about Bootstrap in Shopware can be found here [Theme with Bootstrap Styling](https://developer.shopware.com/docs/guides/plugins/themes/add-theme-inheritance-without-resources.html) and here [Override Bootstrap Variables in a Theme](https://developer.shopware.com/docs/guides/plugins/themes/override-bootstrap-variables-in-a-theme.html).

Bootstrap official docs: [Bootstrap introduction](https://getbootstrap.com/docs/4.1/getting-started/introduction/).

## Conclusion

Choosing the right theme in Shopware is a critical decision that impacts both the frontend experience and the overall manageability of the platform. A well-selected theme provides a solid foundation for building a storefront that is visually appealing, functional, and easy to maintain. By understanding the underlying tech stack—Twig for templating, Bootstrap SCSS for styling, and a lightweight approach to JavaScript—you can ensure that your theme is optimized for performance and maintainability.
