# 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:** 1\
**Showing post:** 7

<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;
    }
  }

```

---

_[View the full topic](https://forum.shopware.com/t/how-to-create-and-save-a-new-field-in-admin-module-in-shopware-6/72110)._
