visibility attribute value is not rendering from product collection in magento 2

by sahana   Last Updated September 19, 2018 16:09 PM

We need to display the visibility of the product in category page,but currently we are not able to fetch its value from product object. we tried with $_attributeLabel = $_product->getResource()->getAttribute($_code)->getFrontendLabel();

It is not working,we have magento 2.2.5 version.

Answers 1


Try this:

<?php echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($block->getProduct(), $block->getProduct()->getAttributeCode(), 'attribute_code'); ?>
Bare Feet
Bare Feet
September 19, 2018 16:01 PM

Related Questions

About Collection Model and Resource Model

Updated September 09, 2017 13:09 PM