# Get category (category custom fields) of parent product from feed

**URL:** <https://forum.shopware.com/t/get-category-category-custom-fields-of-parent-product-from-feed/104620>\
**Category:** Shopware 6 (English)\
**Created:** [23. Juli 2024 um 10:41 UTC](https://forum.shopware.com/t/get-category-category-custom-fields-of-parent-product-from-feed/104620 "2024-07-23T10:41:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![binuabraham990](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@binuabraham990](https://forum.shopware.com/u/binuabraham990)\
**Post date:** [23. Juli 2024 um 10:41 UTC](https://forum.shopware.com/t/get-category-category-custom-fields-of-parent-product-from-feed/104620/1 "2024-07-23T10:41:31Z")

</div>

Hi Guys,

I have a situation,

On **feed generation** , I need to find the category custom field of parent product.  
So I tried something like this

```auto
{% if product.parent %}
    {% set parentCategories = product.parent.categories %}
{% else %}
    {% set productCategories = product.categories %}
{% endif %}
{% for category in productCategories %}
    {{ category.customFields.xxxxxx }}
{% endfor %}

```

And I got this error message

> It is not possible to read the parent association directly. Please read the parents via a separate call over the repository

I believe this is not possible in Shopware directly and we needed an extra query.

So how can we handle this?

I thought about update product Export criteria using some event, create a twig filter, update database directly. What may be the best solution?

Or is there any direct solutions available?

Please share your opinions.  
Thank you
