When calling the function $block->getProduct() in a quote item in the cart page, Magento 2 will return the product and its basic attributes. The attributes that can be retrieved from the product when calling this function in a quote_item page can be found in the file vendor/magento/module-sales/etc/catalog_attributes.xml.

From your own module, you can create the file Vendor/Module/etc/catalog_attributes.xml and add the attributes you need:

<?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="quote_item">
        <attribute name="your_attribute_code1"/>
        <attribute name="your_attribute_code2"/>


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.