I want to query the categories of the product in the product listing of a Shopware app, so that I can query the customFields of all categories. Is this even possible with an app?
I have already tried via a navigation-page-loaded. And when I override the box-standard.html.twig and access the product, I can't access the categories there.
For each product i want the categories extensions

As the
categoriesassociation is not loaded for products in the listing you have to fetch thecategoriesusing an app script.As already noted, add the script to the
navigation-page-loadedhook, i.e. inResources/scripts/navigation-page-loaded/category-loader.twig:Where we first extract all the products, than load the categories of all products at once, and than assign the categories back to the products.
Note that for reading the category entity you need the correct permission, i.e. in the
manifest.xmladd:Now you should be able to access in the
box-standard.html.twigtemplate the categories usingproduct.extensions.myCategories.categories.