Search code examples
shopwareshopware6

Is there a simple example on how to add an entity extension for customers with field in the admin of shopware 6?


I want to add an entity extension to a customer in shopware 6. I was able to do so with the examples in the documentation of shopware on the PHP side and now I wonder how to display and modify this new "field" in the shopware 6 backend.

I searched a lot and also tried to find a simple plugin where I could get some inspiration from, but unfortunately I'm not able to find.

So again the question 😊 Is there any simple example on how to add an entity extension for customers with field in the admin of shopware 6? Or an example plugin, where I can see how it could be done?


Solution

  • What you're (likely) trying to achieve would be the combination of multiple separate tasks.

    1. If you want to store data in the database you'd need a new custom entity
    2. If you want to associate the new entity with the customer you'll need the entity extension
    3. You'll need to add a new field in the administration

    I've linked to examples respectively, but you'll probably need to take the time and invest in studying the documentation regardless.

    I also created an example plugin that combines all these steps and adds a new entity with a height field as association to the customer and displays the field in the administration. You can find the repository here.