# Customfield im Verkaufskanal für csv export

**URL:** https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278
**Category:** Shopware 6 (German)
**Created:** [23. Mai 2025 um 08:24 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278 "2025-05-23T08:24:04Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [23. Mai 2025 um 08:24 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/1 "2025-05-23T08:24:04Z")

</div>

Hallo,

Shopware 6.6.9.0

ich habe in meinem Verkaufskanal von einem Marktplatz (csv Export) einen Schalter (customField) eingebaut. Dieser soll in diesem Marktplatz im Template (csv) den Bestand auf 0 setzten.

`"{% if context.salesChannel.customFields.custom_marktplatz_bestand0 == '1' %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}`

leider funktioniert der Schalter nicht und bekomme immer „Failed rendering string template using Twig“

jemand ne idee?

---

<div class="post-metadata">

### Author: ![frip-tech.de](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/frip-tech.de/32/24453_2.png) [@frip-tech.de](https://forum.shopware.com/u/frip-tech.de)
#### Post date: [23. Mai 2025 um 08:57 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/2 "2025-05-23T08:57:17Z")

</div>

wie heißt denn das Feld im Spaltenkopf?

---

<div class="post-metadata">

### Author: ![Anotherone](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Anotherone](https://forum.shopware.com/u/Anotherone)
#### Post date: [23. Mai 2025 um 09:12 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/3 "2025-05-23T09:12:33Z")

</div>

> [@flundi81](#):
>
> context.salesChannel.customFields.marktplatz\_bestand0

so muss es lauten:

```auto
context.salesChannel.translated.customFields.marktplatz_bestand0

```

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [23. Mai 2025 um 09:40 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/4 "2025-05-23T09:40:01Z")

</div>

> [@Anotherone](#):
>
> `translated`

mit translated geht es auch nicht

```auto
"{% if context.salesChannel.translated.customFields.custom_marktplatz_bestand0 == '1' %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

Failed rendering string template using Twig: Key „custom\_marktplatz\_bestand0“ does not exist as the sequence/mapping is empty in

---

<div class="post-metadata">

### Author: ![Anotherone](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Anotherone](https://forum.shopware.com/u/Anotherone)
#### Post date: [23. Mai 2025 um 10:09 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/5 "2025-05-23T10:09:40Z")

</div>

Ist der Wert auch gesetzt? Bei mir kam das auch erst, als ich dann einen Wert eingetragen hatte, ging es.

Nachtrag: eben nochmal probiert, wenn ich das Feld leere, geht es nicht, kommt die gleche Fehlermeldung wie bei Dir

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [23. Mai 2025 um 10:12 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/6 "2025-05-23T10:12:25Z")

</div>

es ist ja ein Aktiv-Schalter, in der DB steht auch 1 drin

---

<div class="post-metadata">

### Author: ![Anotherone](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Anotherone](https://forum.shopware.com/u/Anotherone)
#### Post date: [23. Mai 2025 um 10:13 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/7 "2025-05-23T10:13:25Z")

</div>

Ahh okay, ich hab es mit einem Textfeld probiert, muss ich mal mit einem Schalter probieren.

---

<div class="post-metadata">

### Author: ![Anotherone](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Anotherone](https://forum.shopware.com/u/Anotherone)
#### Post date: [23. Mai 2025 um 10:17 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/8 "2025-05-23T10:17:19Z")

</div>

So, hab es mit einem Aktiv-Schalter probiert, geht. Hab allerdings im if nur auf den Wert geprüft, ohne ==‚1‘

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [23. Mai 2025 um 10:18 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/9 "2025-05-23T10:18:18Z")

</div>

> [@flundi81](#):
>
> `"{% if context.salesChannel.translated.customFields.custom_marktplatz_bestand0 == '1' %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}`

also so?

```auto
"{% if context.salesChannel.translated.customFields.custom_marktplatz_bestand0 %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

---

<div class="post-metadata">

### Author: ![frip-tech.de](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/frip-tech.de/32/24453_2.png) [@frip-tech.de](https://forum.shopware.com/u/frip-tech.de)
#### Post date: [23. Mai 2025 um 13:15 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/10 "2025-05-23T13:15:01Z")

</div>

Dann heißt der Spaltenkopf wohl translations.DEFAULT.customFields.marktplatz\_bestand0 - bitte testen

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [26. Mai 2025 um 08:02 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/11 "2025-05-26T08:02:39Z")

</div>

irgendwie will das leider so nicht…

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/6/9/6956edb3a1f4b7e808ddd0938bd74493f768fc90.png)

```auto
"{% if translations.DEFAULT.customFields.custom_marktplatz_bestand0 == '1' %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

```auto
"{% if context.salesChannel.translations.DEFAULT.customFields.custom_marktplatz_bestand0 == '1' %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

```auto
"{% if context.salesChannel.translated.customFields.custom_marktplatz_bestand0 == '1' %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

```auto
"{% if context.salesChannel.customFields.custom_marktplatz_bestand0 == '1' %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [26. Mai 2025 um 08:32 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/12 "2025-05-26T08:32:45Z")

</div>

### Bedeutung der Fehlermeldung: `context.salesChannel.customFields = null` und `context.salesChannel.translated.customFields = []`

Diese beiden Ausgaben sind sehr wichtig und sagen uns genau, wo das Problem liegt:

- **`context.salesChannel.customFields = null`** : Das bedeutet, dass die nicht-übersetzten Zusatzfelder für den Verkaufskanal überhaupt nicht geladen wurden.
- **`context.salesChannel.translated.customFields = []` (leeres Array)**: Das bedeutet, dass selbst wenn es übersetzte Zusatzfelder gäbe, die dazugehörige Liste leer ist.

**Zusammengenommen heißt das:** Das Twig-Template für deinen CSV-Export findet **keine Zusatzfelder** beim Verkaufskanal, egal ob übersetzt oder nicht. Der Datenbereich für Zusatzfelder im Verkaufskanal-Kontext ist einfach leer.

---

<div class="post-metadata">

### Author: ![EikeBrandtWarneke](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@EikeBrandtWarneke](https://forum.shopware.com/u/EikeBrandtWarneke)
#### Post date: [26. Mai 2025 um 08:35 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/13 "2025-05-26T08:35:35Z")

</div>

Es kann auch sein, dass die Zahl am Ende des Schlüssels ein Problem darstellt. Probier mal customFields[‚custom\_marktplatz\_bestand0‘] als Alternative. Und am besten mal die custom fields testweise ausgeben, ob die Daten überhaupt vorhanden sind, wie du sie erwartest.

Viele Grüße

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [26. Mai 2025 um 09:10 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/14 "2025-05-26T09:10:26Z")

</div>

leider nicht… hab noch eins erstellt

```auto
"{% if context.salesChannel.customFields.custom_bestand_nix %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

```auto
"{% if context.salesChannel.translated.customFields.custom_bestand_nix %}0{%else%}{{product.availableStock}}{%endif%}";{# stock_amount #}

```

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [26. Mai 2025 um 09:12 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/15 "2025-05-26T09:12:35Z")

</div>

Gemini sagt mir, dass dieses CustomField nicht im Feed geladen wird.  
aus Performance Gründen sind nicht alle „Verwenden für“ Optionen verfügbar.

---

<div class="post-metadata">

### Author: ![EikeBrandtWarneke](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@EikeBrandtWarneke](https://forum.shopware.com/u/EikeBrandtWarneke)
#### Post date: [26. Mai 2025 um 09:23 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/16 "2025-05-26T09:23:07Z")

</div>

Bitte hört auf dem Blödsinn von KI ungefiltert zu glauben. Wenn im Kontext der sales channel vorhanden ist, dann sind auch immer die custom fields dabei - die gehören zwingend zur entity.

Noch einmal der Hinweis: prüfe einmal, ob die Daten überhaupt wie vermutet vorliegen, indem du sie ausgibst.

Viele Grüße

---

<div class="post-metadata">

### Author: ![flundi81](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/flundi81/32/24725_2.png) [@flundi81](https://forum.shopware.com/u/flundi81)
#### Post date: [26. Mai 2025 um 09:39 UTC](https://forum.shopware.com/t/customfield-im-verkaufskanal-fuer-csv-export/107278/17 "2025-05-26T09:39:32Z")

</div>

meinste das hier?

```auto
context.salesChannel.customFields = null
context.salesChannel.translated.customFields = []

```
