# Custom Field (Freitextfeld) Error im Feed

**URL:** <https://forum.shopware.com/t/custom-field-freitextfeld-error-im-feed/97251>\
**Category:** Shopware 6 (German)\
**Created:** [24. November 2022 um 07:33 UTC](https://forum.shopware.com/t/custom-field-freitextfeld-error-im-feed/97251 "2022-11-24T07:33:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ergobasis](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ergobasis](https://forum.shopware.com/u/ergobasis)\
**Post date:** [24. November 2022 um 07:33 UTC](https://forum.shopware.com/t/custom-field-freitextfeld-error-im-feed/97251/1 "2022-11-24T07:33:22Z")

</div>

Hey Leute,

so langsam habe ich das Gefühl, ich werde hier bekloppt. Die ganze Zeit hat die Einbindung eines Custom Fields in den Produktexport problemlos geklappt. Nach ein paar Änderungen im Feed und in der dynamischen Produktgruppe zum entsprechenden Feed, bekomme ich plötzlich einen Error betreffend des eingebundenen Freitextfelds.

 ![Feed Problem](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/d/4/d470d8220c847b28271bf9dfcb6e451d6fdfed61.png)

> Failed rendering string template using Twig: Failed rendering string template using Twig: Key „product\_customfields\_googlecategory“ does not exist as the array is empty in „964663b41a248fa89f3d067e9fee3fe6“ at line 17.

Hier nochmal die Einstellung des entsprechenden Custom Fields

 ![Feed Problem2](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/9/7/971b2a27022a2a85d8963fb691a724df33ef9eaf.png)

Hat noch jemand dasselbe Problem?  
Mein Shopware 6 ist aktuell auf Version 6.4.17.0.  
Mir ist komplett schleierhaft, woher dieses Problem kommen könnte.  
Ich musste eine kleine Anpassung im Core machen, siehe [https://forum.shopware.com/t/google-shopping-feed-varianten-und-eigenschaften/70536/12](https://forum.shopware.com/t/google-shopping-feed-varianten-und-eigenschaften/70536/12), dabei handelt es sich um eine einzige Zeile…

Hier nochmal mein aktueller Code für die Feed Produktzeile

```auto
<item>
    <g:id>{{ product.productNumber }}</g:id>
    {% if product.parentId is not null %}
        {% set variantInfo = '' %}
        {% for option in product.options %}
            {% set variantInfo = variantInfo ~ ', ' ~ option.group.name ~ ': ' ~ option.translated.name %}
        {% endfor %}
        <title>{{ product.translated.name|escape }}{{ variantInfo|u.truncate(150, '...')|escape }}</title>
    {% else %}
        <title>{{ product.translated.name|escape }}</title>
    {% endif %}
    <description>{{ product.translated.description|striptags|u.truncate(900, '...')|escape }}</description>
    <g:google_product_category>
        {{ product.translated.customFields.product_customfields_googlecategory }}
    </g:google_product_category>
    {%- if product.categories.count > 0 -%}
        <g:product_type>{{ product.categories.first.getBreadCrumb|slice(1)|join(' > ')|raw|escape }}</g:product_type>
    {%- endif -%}
    <link>{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}</link>
    {% if product.cover.media is defined %}
        <g:image_link>{{ product.cover.media.url }}</g:image_link>
        {% if product.media|length > 1 -%}
            {% for media in product.media %}
                <additional_image_link>{{ media.media.url }}</additional_image_link>
            {% endfor %}
        {% endif %}
    {% endif %}
    <g:condition>new</g:condition>
    <g:availability>
        {%- if product.availableStock >= product.minPurchase and product.deliveryTime -%}
            in_stock
        {%- elseif product.availableStock < product.minPurchase and product.deliveryTime and product.restockTime -%}
            backorder
        {%- else -%}
            out_of_stock
        {%- endif -%}
    </g:availability>
    {%- if product.availableStock < product.minPurchase and product.deliveryTime and product.restockTime -%}
        <g:availability_date>
            {% set restockDays = '+' ~ product.restockTime ~ ' days' %}
            {{ ("now"|date_modify(restockDays)|date("Y-m-d\\Th:i+0100")) }}
        </g:availability_date>
    {% endif %}
    {% set price = product.calculatedPrice %}
    {%- if product.calculatedPrices.count > 0 -%}
        {% set price = product.calculatedPrices.last %}
    {%- endif -%}
    <g:price>{{ price.unitPrice|number_format(context.currency.itemRounding.decimals, '.', '') }} {{ context.currency.isoCode }}</g:price>
    {% if product.unit.shortCode is defined and product.unit.shortCode is not null %}
        <g:unit_pricing_measure>{{ product.purchaseUnit }} {{ product.unit.shortCode }}</g:unit_pricing_measure>
    {% endif %}
    {% if product.unit.shortCode is defined and product.unit.shortCode is not null %}
        <g:unit_pricing_base_measure>{{ product.referenceUnit}} {{ product.unit.shortCode }}</g:unit_pricing_base_measure>
    {% endif %}
    <g:brand>{{ product.manufacturer.translated.name|escape }}</g:brand>
    <g:gtin>{{ product.ean }}</g:gtin>
    <g:mpn>{{ product.manufacturerNumber }}</g:mpn>
    <g:shipping>
        <g:country>DE</g:country>
        <g:service>Standard</g:service>
        <g:price>0.00 {{ context.currency.isoCode }}</g:price>
    </g:shipping>
    {% set break = 0 %}
    {% for tag in product.tagIds %}
        {% if break == 0 %}
            {% if (tag == '042fad9a99934c40b73134aa72a19479') or (tag == '0c1da5467c564439afacd80e14247970') %}
                   {% for tag in product.tagIds %}
                       {% if break == 0 %}
                            {% if (tag == '8ed3c0c4bf35483ebdae3082e23668a3') or (tag == 'c2e14510db5c4899aae8fa3895078f75') %}
                                <g:shipping>
                                   <g:country>AT</g:country>
                                   <g:service>Standard</g:service>
                                   <g:price>90.00 {{ context.currency.isoCode }}</g:price>
                                </g:shipping>
                                {% set break = 1 %}
                            {% elseif (tag == 'b537bc67ca8d4e669721ab7ec3435db2') or (tag == '2ec73a621c3e409e9ff2f2af75c621d2') %}
                                {% if price.unitPrice > 49 %}
                                    <g:shipping>
                                       <g:country>AT</g:country>
                                       <g:service>Standard</g:service>
                                        <g:price>0.00 {{ context.currency.isoCode }}</g:price>
                                    </g:shipping>
                                    {% set break = 1 %}
                                {% else %}
                                    <g:shipping>
                                       <g:country>AT</g:country>
                                       <g:service>Standard</g:service>
                                        <g:price>20.00 {{ context.currency.isoCode }}</g:price>
                                    </g:shipping>
                                    {% set break = 1 %}
                                {% endif %}
                            {% elseif (tag == '64d04f3ec1b840499e0083c492c489ff') or (tag == 'f9506cfb59af4440862c1f3bec808b86') or (tag == 'b3b8c3ba9aab4fcf8e56fbe44082931e') or (tag == 'f138cbd1c3ea4f0b966f372a0f4d4ca9')%}
                                {% if price.unitPrice > 49 %}
                                    <g:shipping>
                                       <g:country>AT</g:country>
                                       <g:service>Standard</g:service>
                                        <g:price>0.00 {{ context.currency.isoCode }}</g:price>
                                    </g:shipping>
                                    {% set break = 1 %}
                                {% else %}
                                    <g:shipping>
                                       <g:country>AT</g:country>
                                       <g:service>Standard</g:service>
                                        <g:price>3.95 {{ context.currency.isoCode }}</g:price>
                                    </g:shipping>
                                    {% set break = 1 %}
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    {% endfor %}
            {% elseif loop.last %}
                <g:shopping_ads_excluded_country>AT</g:shopping_ads_excluded_country>
            {% endif %}
        {% endif %}
    {% endfor %}

    {% set break2 = 0 %}
    {% for tag in product.tagIds %}
        {% if break2 == 0 %}
            {% if (tag == 'e7660d292353470d936e896f0bca08b2') or (tag == 'e9c37bd2c6bb428598a5cd523477be4b') %}
               {% for tag in product.tagIds %}
                   {% if break2 == 0 %}
                        {% if (tag == '64d04f3ec1b840499e0083c492c489ff') or (tag == 'f9506cfb59af4440862c1f3bec808b86') or (tag == 'b3b8c3ba9aab4fcf8e56fbe44082931e') or (tag == 'f138cbd1c3ea4f0b966f372a0f4d4ca9') %}
                            <g:shipping>
                                <g:country>CH</g:country>
                                <g:service>Standard</g:service>
                                {% if price.unitPrice > 400 %}
                                    <g:price>{{ price.unitPrice * 0.1 }} {{ context.currency.isoCode }}</g:price>
                                {% else %}
                                    <g:price>25.00 {{ context.currency.isoCode }}</g:price>
                                {% endif %}
                            </g:shipping>
                            {% set break2 = 1 %}
                        {% elseif loop.last %}
                                <g:shopping_ads_excluded_country>CH</g:shopping_ads_excluded_country>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            {% elseif loop.last %}
                <g:shopping_ads_excluded_country>CH</g:shopping_ads_excluded_country>
            {% endif %}
        {% endif %}
    {% endfor %}
</item>

```

---

<div class="post-metadata">

**Author:** ![xp24](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/xp24/32/17219_2.png) [@xp24](https://forum.shopware.com/u/xp24)\
**Post date:** [12. Januar 2023 um 09:16 UTC](https://forum.shopware.com/t/custom-field-freitextfeld-error-im-feed/97251/2 "2023-01-12T09:16:44Z")

</div>

Hallo, ich habe exakt das gleiche Problem, gibt es hier schon Erkenntnisse?

**Lösung in einem anderen Beitrag gefunden!**  
Im Feed muss man ein Freitextfeld wohl erst auf „definded“ abfragen: \<g:google\_product\_category\> {% if product.translated.customFields.product\_customfields\_googlecategory is defined %}

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.shopware.com/u/abdullah)\
**Post date:** [12. Januar 2023 um 10:27 UTC](https://forum.shopware.com/t/custom-field-freitextfeld-error-im-feed/97251/3 "2023-01-12T10:27:58Z")

</div>

Problem wird wahrscheinlich sein, dass bei einem Produkt das Freitextfeld nicht gesetzt ist und somit der Fehler auftaucht.  
Mit „is defined“ kann man zuerst überprüfen, ob das Freitextfeld für ein Produkt definiert ist und anschließend ausgeben.

---

<div class="post-metadata">

**Author:** ![ergobasis](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ergobasis](https://forum.shopware.com/u/ergobasis)\
**Post date:** [13. Januar 2023 um 07:14 UTC](https://forum.shopware.com/t/custom-field-freitextfeld-error-im-feed/97251/4 "2023-01-13T07:14:49Z")

</div>

_facepalm_  
Da hätte ich tatsächlich drauf kommen können.  
Möglicherweise hatte ich damals noch nicht den Wissensstand, den ich heute bezüglich SW6 habe. Aber sehr gut, dass das geklärt ist.
