Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 31, 2025

The documentation showed an incorrect service registration example using Shopware\Core\Checkout\Document\Service\PdfRenderer (a core file renderer) with the wrong tag document_type.renderer, which contradicted the instruction on line 173 to use tag document.renderer for custom document renderers.

Changes

  • Replaced incorrect core service example with proper ExampleDocumentRenderer registration
  • Added complete service definition with all required constructor arguments matching the PHP class implementation
  • Corrected tag from document_type.renderer to document.renderer
  • Added full XML structure for copy-paste usage

Before

<service id="Shopware\Core\Checkout\Document\Service\PdfRenderer">
    ...
    <tag name="document_type.renderer" key="pdf"/>
</service>

After

<service id="Swag\BasicExample\Core\Checkout\Document\Render\ExampleDocumentRenderer">
    <argument type="service" id="order.repository"/>
    <argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentConfigLoader"/>
    <argument type="service" id="Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface"/>
    <argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentFileRendererRegistry"/>
    <tag name="document.renderer"/>
</service>

Fixes the confusion between document type renderers (tag: document.renderer) and file type renderers (tag: document_type.renderer).

Original prompt

This section details on the original issue you should resolve

<issue_title>Wrong service in services.xml - Add Custom Document Type</issue_title>
<issue_description>Hey,

when creating a custom document type, an incorrect service is specified.
Shouldn't it actually be Swag\BasicExample\Core\Checkout\Document\Render\ExampleDocumentRenderer
instead of

<service id="Shopware\Core\Checkout\Document\Service\PdfRenderer">

?

I find that confusing. It might also be a good idea to include an example of what the whole thing should look like so that you at least get a working template, something like this:

            <service id="Swag\BasicExample\Core\Checkout\Document\Render\ExampleDocumentRenderer ">
                <argument type="service" id="order.repository"/>
                <argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentConfigLoader"/>
                <argument type="service" id="Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface"/>
                <argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentFileRendererRegistry"/>
                <argument>%kernel.project_dir%</argument>
                <tag name="document.renderer" key="pdf"/>
            </service>
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Isengo1989 <8600299+Isengo1989@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect service in services.xml for custom document type Fix incorrect service registration example in custom document type guide Oct 31, 2025
Copilot AI requested a review from Isengo1989 October 31, 2025 14:14
Copilot finished work on behalf of Isengo1989 October 31, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong service in services.xml - Add Custom Document Type

2 participants