Creating or replacing service with tag

Hello everyone,

I have one question about creating or replacing services in custom plugins. More precisely, I’m going to replace service “shopware_searchdbal.property_facet_handler_dbal”, service definition in shopware core looks like:

My service definition in my custom plugin looks like:

    public function replaceSearchdbalPropertyFacetHandlerDbalService()
        $shopwareStorefrontPropertyGatewayService = Shopware()->Container()->get('shopware_storefront.property_gateway');
        $dbalQueryBuilderFactoryService = Shopware()->Container()->get('shopware_searchdbal.dbal_query_builder_factory');
        $queryAliasMapperService = Shopware()->Container()->get('query_alias_mapper');

            new AmsPropertyFacetHandler(

my question is how to add tag in plugin service definition?

Thanks in advice.

Whoever is able to help?

I can help you, but what excatly do you want to do? To create your own service for some events or to decorate shopwares existing event?

I want to extend “PropertyFacetHandler” because I would like filters that have numerical values to be presented as sliders. I modified method (createCollectionResult)  from my custom PropertyFacetHandler:

                if ($useSlider) {

                    list($min, $max, $activeMin, $activeMax, $minField, $maxField) = $this->getStats($group, $criteria);

                    $results[] = new RangeFacetResult(
                        (float) $min,
                        (float) $max,
                        (float) $activeMin,
                        (float) $activeMax,
                } elseif ($useMedia) {
                    $results[] = new MediaListFacetResult(
                } else {
                    $results[] = new ValueListFacetResult(

And that all I want to modify. To do this, I need to overwrite the service:


But I don’t know how to add tag to service in plugin configuration.

In that case you have to decorate shopwares event.

Create custom service in services.xml, for example:


  • Then create class (SearchDbal) in “CustomPlugin/Events”
  • Create public method in that class (propertyFacetHandlerDbal)

In that method you have to get shopwares service id, and put it into the new class and then replace that class with the old one by returnin it into the service id
There is an example in the shopwares documentation about decorating an service, just go to the line where the title is “Decorate the WhiteListService