Magento 2.1 Grouped Products – How to Get Custom Product Attribute by Product-ID in Grouped Product

attributesgrouped-productsmagento-2.1product-attributesimple-product

I want to display custom product attribute of simple product on Grouped-product in Grouped phtml file (app\design\frontend\Company\theme\Magento_GroupedProduct\templates\product\view\type\grouped.phtml) but not getting success.

There are few simple products added in grouped product and all simple product have 1 attribute which i want to display on grouped-product-page.

Magento Version: 2.1.8 but I am ok if i got response for any magento 2.1.x version.

Any help would highly appreciated. Thanks.

Best Answer

I done with this code:

$my_attr = $this->getProduct()->getResource()->getAttributeRawValue($_item->getId(),'attribute_code',$_item->getId());

I added this code in app\design\frontend\Company\theme\Magento_GroupedProduct\templates\product\view\type\grouped.phtml

My custom attribute code: attribute_code

Related Topic