magento 2:如何向购物车添加显示自定义html的属性:

magento 2:如何向购物车添加显示自定义html的属性:,magento,attributes,cart,Magento,Attributes,Cart,当产品具有以下属性时,“我的属性”应在购物车上显示高于价格的html: /magento_文件/app/code/magento/etc/catalog_attributes.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=&q

当产品具有以下属性时,“我的属性”应在购物车上显示高于价格的html:

/magento_文件/app/code/magento/etc/catalog_attributes.xml

    <?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="badge_free_shipping"/> 
    </group>
    </config>

在default.phtml中: getResource()->getAttribute('badge\u free\u shipping')- >getFrontend()->getValue($\产品); 如果($_free_shipping='Yes'):?> 南非免费送货

我在未定义变量“\u product”的system.log中出错, 所以我包括: get('Magento\Framework\Registry')->Registry('current_product')//得到 当前产品 ?>

但我的购物篮项目在购物车页面上消失了