How to get Attributes of a Group of Default Attribute Set in my custom phtml in Magento_Catalog
module.
using following code
catalog_product_view.xml:
<referenceContainer name="after.body.start">
<block class="Magento\Catalog\Block\Product\View\abstractView" name="product_view_custom_features"
template="Magento_Catalog::product/view/features.phtml" before="-"></block>
</referenceContainer>
template:
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_product = $block->getProduct();
$productAttributes=$product->getAttributes();
$group_id=9;
$attributeSetId=4;
foreach ($productAttributes as $attribute) {
if ($attribute->isInGroup($attributeSetId, $group_id)) {
echo $attribute->getFrontendLabel().' : '.$attribute->getFrontend()->getValue($product).'<br />';
}
}