# Element zu Shopware.State hinzufügen in einem überschriebene Komponente

**URL:** <https://forum.shopware.com/t/element-zu-shopware-state-hinzufugen-in-einem-uberschriebene-komponente/69105>\
**Category:** Programmierung\
**Created:** [22. August 2020 um 09:42 UTC](https://forum.shopware.com/t/element-zu-shopware-state-hinzufugen-in-einem-uberschriebene-komponente/69105 "2020-08-22T09:42:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rammi22](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rammi22](https://forum.shopware.com/u/rammi22)\
**Post date:** [22. August 2020 um 09:42 UTC](https://forum.shopware.com/t/element-zu-shopware-state-hinzufugen-in-einem-uberschriebene-komponente/69105/1 "2020-08-22T09:42:30Z")

</div>

Hallo,

Ich habe die _sw-product-detail_ Komponente überschrieben. In der Elternkomponente wird ein state-Objekt gesetzt, das _swProductDetail._ Diesem state-Objekt möchte ich in der Child-Komponente ein item hinzufügen. Mit Shopware.State.commit() funktioniert das nicht:

```
...
methods: {
      getMyList() {
          const criteria = new Criteria();
          this.myListRepository
              .search(criteria, Shopware.Context.api)
              .then((result) => {
                  if(result.total > 0) {
                      Shopware.State.commit('swProductDetail/myList', result);
                  }
              })
              .then(() => {
                  console.log(Shopware.State.get('swProductDetail'));
              });
      }
  }
...

```

Wie wird das umgesetzt?
