I’m building a Luma child theme and I want to display my “brand” product attribute above the product title on my product page.
I am currently using the following code in my child theme’s copy of catalog_product_view.xml to also display my “ingredients” attribute, this works perfectly because the attribute type is just text:
<referenceContainer name="product.info.main">
<block class="MagentoCatalogBlockProductViewDescription" name="product.info.ingredients" template="product/view/attribute.phtml" before="-">
<arguments>
<argument name="at_call" xsi:type="string">getIngredients</argument>
<argument name="at_code" xsi:type="string">ingredients</argument>
<argument name="css_class" xsi:type="string">ingredients</argument>
</arguments>
</block>
</referenceContainer>
My issue is that my Brand attribute type is a dropdown box, if I try to use the code above for dropdown attributes, it just displays a number in the frontend and not my dropdown box value.
How can I properly display the first value in the list? I do not need to display the attribute in a dropdown on the frontend, there is only one value associated with this dropdown, not a list with multiple options.
The fact that the attribute type is a dropdown is only for backend management purposes, so displaying the first value from the list as just text would be fine.