# Wie erstelle ich ein Plugin das Zusatzfelder automatisch generiert?

**URL:** <https://forum.shopware.com/t/wie-erstelle-ich-ein-plugin-das-zusatzfelder-automatisch-generiert/71715>\
**Category:** Programmierung\
**Created:** [22. Dezember 2020 um 14:06 UTC](https://forum.shopware.com/t/wie-erstelle-ich-ein-plugin-das-zusatzfelder-automatisch-generiert/71715 "2020-12-22T14:06:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Federico](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/federico/32/14491_2.png) [@Federico](https://forum.shopware.com/u/Federico)\
**Post date:** [22. Dezember 2020 um 14:06 UTC](https://forum.shopware.com/t/wie-erstelle-ich-ein-plugin-das-zusatzfelder-automatisch-generiert/71715/1 "2020-12-22T14:06:20Z")

</div>

Guten Tag,

ich bin langsam am verzweifeln …

Ich habe ein Plugin erstellt nach ( [https://docs.shopware.com/en/shopware-platform-dev-en/developer-guide/custom-fields#global-custom-field-sets )](https://docs.shopware.com/en/shopware-platform-dev-en/developer-guide/custom-fields#global-custom-field-sets)das mir nach Installieren und aktivieren des Plugins automatisch Zusatzfelder generiert.

&nbsp;

Mein Code sieht wie folgt aus:

```
_namespace_ InstallCustomfields\Service\Core\System\CustomFields; _use_ Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; _class_ SwagCustomFieldSetService { _/\*\*_ _\*_ _@var_ _EntityRepositoryInterface_ _\*/_ _private_ $customFieldSetRepository; _public function_ \_\_construct(EntityRepositoryInterface $customFieldSetRepository) { $this-\>customFieldSetRepository = $customFieldSetRepository; _// ..._ } _public function_ create($context): _void_ { $this-\>customFieldSetRepository-\>create([['name' =\> 'swag\_example\_set', 'global' =\> true, 'config' =\> [ 'label' =\> [ 'de-DE' =\> 'Beispiel Plugin Zusatzfeld Set', 'en-GB' =\> 'Example plugin custom field set'] ], 'relations' =\> [['entityName' =\> 'product']], 'customFields' =\> [['name' =\> 'swag\_example\_size', 'type' =\> CustomFieldTypes::INT], ['name' =\> 'swag\_example\_color', 'type' =\> CustomFieldTypes::TEXT] ] ] ], $context); } }

```

&nbsp;

&nbsp;

services.xml:

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/a/a7262ab15833f7563a4be62937821e725cd191bb.png)

&nbsp;

&nbsp;

&nbsp;

&nbsp;

Was mache ich falsch?

&nbsp;

Mit freundlichen Grüßen

Federico
