# How to create and save a new field in admin module in shopware 6?

**URL:** <https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110>\
**Category:** Programming (EN)\
**Created:** [15. Januar 2021 um 06:18 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110 "2021-01-15T06:18:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)\
**Post date:** [15. Januar 2021 um 06:18 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110/1 "2021-01-15T06:18:29Z")

</div>

Hi

I want to create and save a new field in product detail page in Shopware 6.

I don’t want to use the custom fields.

I want to create a new field in the products table and save the value from the admin product edit page.  
&nbsp;  
How it is possible?

---

<div class="post-metadata">

**Author:** ![lanea](https://avatars.discourse-cdn.com/v4/letter/l/c67d28/32.png) [@lanea](https://forum.shopware.com/u/lanea)\
**Post date:** [16. Januar 2021 um 18:02 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110/2 "2021-01-16T18:02:54Z")

</div>

maybe with entity extension -\> [Shopware 6: Entity extension](https://docs.shopware.com/en/shopware-platform-dev-en/how-to/entity-extension)

&nbsp;

---

<div class="post-metadata">

**Author:** ![drpn\_swf](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@drpn\_swf](https://forum.shopware.com/u/drpn_swf)\
**Post date:** [22. Mai 2021 um 12:51 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110/3 "2021-05-22T12:51:23Z")

</div>

this only shows, how to extend the entity.  
but the actual question is:  
How can i store the value of my new field on click of Save button in the product edit page.

 ![Fantastic-Iron-Wonderwear-Products-Shopware-Administration](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/7/7c3f16e00176967c9f216b0336262acbafcf8217.png)

---

<div class="post-metadata">

**Author:** ![shopware6ux](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@shopware6ux](https://forum.shopware.com/u/shopware6ux)\
**Post date:** [26. Mai 2021 um 14:45 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110/4 "2021-05-26T14:45:06Z")

</div>

I’m also stuck with the same problem, in your case, were you able to fetch your input text in your backend?

---

<div class="post-metadata">

**Author:** ![webjohn](https://avatars.discourse-cdn.com/v4/letter/w/df705f/32.png) [@webjohn](https://forum.shopware.com/u/webjohn)\
**Post date:** [14. Oktober 2021 um 13:23 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110/5 "2021-10-14T13:23:04Z")

</div>

I Try to do something similar for the OrderLineItems.

In the OrderLineItems it is not possible to configure custom fields so I made an entity extension.

But how can I now extend the Administration to save content the field of my extension ?

Maybe someone of the shopware team can provide an answer for that question ?

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [14. Oktober 2021 um 18:36 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110/6 "2021-10-14T18:36:49Z")

</div>

> **[Using the data handling](https://developer.shopware.com/docs/guides/plugins/plugins/administration/using-data-handling)**

---

<div class="post-metadata">

**Author:** ![wirduzen-felix](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@wirduzen-felix](https://forum.shopware.com/u/wirduzen-felix)\
**Post date:** [20. Oktober 2021 um 08:13 UTC](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110/7 "2021-10-20T08:13:23Z")

</div>

You can simply write your data into `this.product.extensions.your-extension` Shopware will automatically write it to the database when you save the product (Autoloading might need to be active for this to work I’m not sure). This worked for me:

```auto
  methods: {
    // This is the @change Method on my Input
    updateData(){
      this.myExtension.option = this.selectedOption;
      this.product.extensions.myExtension = this.myExtension;
    }
  },
  created(){
    if(!this.product.extensions.myExtension){
      this.myExtension = this.myExtensionRepository.create(Shopware.Context.api);
      this.myExtension.productId = this.product.id;
    }else{
      this.myExtension = this.product.extensions.myExtension;
      this.selectedOption = this.product.extensions.myExtension.option;
    }
  }

```
