In my templates I want to have access to custom product attributes on the detail page, the cart and also the category list view. This can be (or should be) easily achieved by creating a
Vendor/Module/etc/catalog_attributes.xml with for example the following content:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd"> <group name="catalog_product"> <attribute name="my_attribute"/> </group> <group name="quote_item"> <attribute name="my_attribute"/> </group> </config>
This works great in the cart or whenever I load a collection myself in custom controllers for example. The additional attributes are automatically loaded.
However for some reason it does not work in the product list of
catalog_category_view. The attribute is not present in the loaded collection of the list/grid view.
<group name="catalog_product"> also affect the category list view? Am I missing something?