---
title: Plugin Configuration | Shopware Community Hub
description: >-
  Learn how to add configuration fields to your Shopware plugin to make it more
  flexible, reusable, and customizable.
canonical_url: 'https://hub.shopware.com/learn/unit/plugin-configuration'
---

# Plugin Configuration

<LearningObjectives>

- Know how to add an input field to your plugin configuration.
- Learn how to add a snippet field to your plugin for translations.
- Understand how to add a color picker field to your plugin.

</LearningObjectives>

# Plugin Configuration

In this learning unit, you will learn how to **create configuration fields** for your Shopware plugin. By using configuration fields, your plugin becomes **more flexible**, **reusable**, and **customizable** for different projects and environments.

## Real-World Example

Imagine you are developing a plugin that should display a banner on the homepage on a **specific date**, for example, **Black Friday**. To make this feature configurable, you can add a **date input field** to your plugin configuration. This allows the merchant to set the date directly in the administration panel without touching any code.

### Adding the `config.xml` File to Your Plugin

To add configurations to your plugin, you need to create a `config.xml` file in the `src/Resources/config` directory of your plugin. This file will contain all the configurations for your plugin.

```txt
└── plugins
    └── EventPlugin
        ├── src
        │   ├── Resources
        │   │   └── config
        │   │       └── config.xml 
        │   └── EventPlugin.php
        └── composer.json
```

In the beginning, the `config.xml` file should look like this:

```xml
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/shopware/trunk/src/Core/System/SystemConfig/Schema/config.xsd">

</config>
```

### Add a `date` Field

A **date** field is a common input field type that allows the user to select a date from a calendar. To add a date field to your plugin, you need to add the following code to your `config.xml` file:

```xml
<input-field type="date">
    <name>specialEventDate</name>
    <label>Date</label>
    <defaultValue>2025-11-29T00:00:00</defaultValue>
</input-field>
```

Your `config.xml` file should now look like this:

```xml
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/shopware/trunk/src/Core/System/SystemConfig/Schema/config.xsd">

  <card>
    <title>Minimal configuration</title>

    <input-field type="date">
      <name>specialEventDate</name>
      <label>Date</label>
      <defaultValue>2025-09-29T00:00:00</defaultValue>
    </input-field>
  </card>

</config>
```

Great, we can now check in our PHP code for this value, and if the date is today, we can show the banner. However, this would be very static.

How about adding a **translatable text field** to the configuration, so the user can set the banner text in multiple languages?

### Add a Snippet Field

A snippet is a **translatable piece of text**. It allows you to manage and display text content in multiple languages, making your plugin multilingual and user-friendly – a must-have for international shops. They are often used for labels, messages, and other text elements in the Shopware Frontend and Backend.

To add a snippet field to your plugin, use the **`sw-snippet-field`** component:

```xml
<component name="sw-snippet-field">
  <name>bannerText</name>
  <label>Text for the banner</label>
  <snippet>eventPlugin.banner.text</snippet>
</component>
```

At this stage, your `config.xml` file should look like this:

```xml
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/shopware/trunk/src/Core/System/SystemConfig/Schema/config.xsd">

  <card>
    <title>Minimal configuration</title>

    <input-field type="date">
      <name>specialEventDate</name>
      <label>Date</label>
      <defaultValue>2025-09-29T00:00:00</defaultValue>
    </input-field>

    <component name="sw-snippet-field">
      <name>bannerText</name>
      <label>Text for the banner</label>
      <snippet>eventPlugin.banner.text</snippet>
    </component>
  </card>

</config>
```

[Components](https://developer.shopware.com/docs/guides/plugins/plugins/plugin-fundamentals/add-plugin-configuration.html#advanced-custom-input-fields) are **custom input fields** that can be used to create complex configurations. In this case, we are using the **`sw-snippet-field`** component to create a snippet field for the banner text across different languages.

Perfect, and what about the colors? Let's add a **color picker** to the configuration so we can also use the banner in different colors (for example, red for Valentine's Day).

### Add a Color Picker Field

![Color picker field](assets/settings-custom-fields-color-picker.jpg)

To add a color picker field to your plugin, you need to add the following code to your `config.xml` file:

```xml
<input-field type="colorpicker">
  <name>bannerBackgroundColor</name>
  <label>Color for the banner</label>
  <defaultValue>#000000</defaultValue>
</input-field>

<input-field type="colorpicker">
  <name>bannerTextColor</name>
  <label>Text color for the banner</label>
  <defaultValue>#FFFFFF</defaultValue>
</input-field>
```

At this stage, your `config.xml` file should look like this:

```xml
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/shopware/trunk/src/Core/System/SystemConfig/Schema/config.xsd">

  <card>
    <title>Minimal configuration</title>

    <input-field type="date">
      <name>specialEventDate</name>
      <label>Date</label>
      <defaultValue>2025-09-29T00:00:00</defaultValue>
    </input-field>

    <component name="sw-snippet-field">
      <name>bannerText</name>
      <label>Text for the banner</label>
      <snippet>eventPlugin.banner.text</snippet>
    </component>

    <input-field type="colorpicker">
      <name>bannerBackgroundColor</name>
      <label>Color for the banner</label>
      <defaultValue>#000000</defaultValue>
    </input-field>

    <input-field type="colorpicker">
      <name>bannerTextColor</name>
      <label>Text color for the banner</label>
      <defaultValue>#FFFFFF</defaultValue>
    </input-field>
    
  </card>
</config>
```

With this, the merchant can customize both the **background color** and the **text color** for the banner directly from the administration panel.

### Extending Your Configuration

You can add more complex fields such as:

- **Entity Select Fields** to select specific entities (e.g., categories or products).
- **Multi-Select Fields** to choose multiple options (e.g., available viewports).

For example, you could create a **multi-select-field** to show the banner only on **desktop** and **tablet** devices.

If you want to explore all options, please visit the [official developer documentation](https://developer.shopware.com/docs/guides/plugins/plugins/plugin-fundamentals/add-plugin-configuration.html).

### Where Plugin Configuration Values Are Stored

Whenever a plugin configuration is created or its value has been updated, Shopware saves the values in the `system_config` table.

You can find your configuration entries by searching for your plugin prefix (usually the technical plugin name) in the `configuration_key` column.

## Summary

In this learning unit, you have learned:

- How to **add a configuration file (`config.xml`)** to your plugin.
- How to create a **date input field** for dynamic features like event banners.
- How to use a **snippet field** for translations.
- How to **add color picker fields** for customizable styles.
- That configuration fields make your plugin **flexible**, **reusable**, and **merchant-friendly**.

With this knowledge, you can now create plugins that are easily configurable and adaptable to various business requirements.
