Before moving forward to learn how to get plugin configuration in Shopware, it is recommended to have the knowledge to create plugin configuration in Shopware. In Shopware we can use the store configuration value in any class. Let’s understand it with help of an example. We have a controller class from which we will return the config value to the view page.

Here is an example of a config.xml file. We are putting only a text field there.

<!-- File path: <project-directory>/custom/plugins/WebbytroopsShopFinder/src/Resources/config/config.xml-->
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="">
        <title>Minimal configuration</title>
        <title lang="de-DE">German Minimal configuration</title>
        <input-field type="text">
            <helpText>Title is the main primary section to enter</helpText>

Following the above example, you will a text field Title in the plugin’s configuration section. The second thing we need to do is read the configuration value in our required class. We are using a controller, so need to inject the dependency in the service configuration using the Symfony DI container.

<?xml version="1.0" ?>

<container xmlns=""

        <service id="Webbytroops\ShopFinder\Storefront\Controller\ShopFinderController" public="true">
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            <argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService" /> <!-- Here we injected the configuration service. !>


Now move to the controller file where in the constructor we need to provide the argument of SystemConfigService class. You can get the config value simply with one line $this->systemConfigService->get(‘title’). What if there are multiple module using the same “title” for their configuration, how Shopware will decide that? For that, we need to provide the argument “title” along with module name such as $this->systemConfigService->get(‘WebbytroopsShopFinder.config.title’). Now it will read the WebbyTroopsShopFinder module’s config.xml file to render the value of title field.

<?php declare(strict_types=1);
 * (c) shopware AG <>
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.

namespace Webbytroops\ShopFinder\Storefront\Controller;
use Shopware\Core\System\SystemConfig\SystemConfigService;
class ShopFinderController extends StorefrontController
    . . . .
    private SystemConfigService $systemConfigService;
    public function __construct(
        . . . .
        SystemConfigService $systemConfigService
    ) {
        . . . .
        $this->systemConfigService = $systemConfigService;

     * @HttpCache()
     * @Route("/shopfinder/new", name="", options={"seo"="false"}, methods={"GET"})
    public function shopFinderFormPage(Request $request, RequestDataBag $data, SalesChannelContext $context): Response
        $title = $this->systemConfigService->get('WebbytroopsShopFinder.config.title');
        $page = $this->shopFinderPageLoader->load($request, $context);
        return $this->renderStorefront(
            '@WebbytroopsShopFinder/storefront/page/wt_index.html.twig', [
                'page' => $page

Sometimes it may require clearing the cache for changes to take place. Clear the cache with bin/console cache:clear command.

Other topics you may like: