How to display Attribute Group Name on Product page?

How to display Attribute Group Name on Product page?

July 14, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to display Attribute Group Name on Product page?

Displaying Attribute Group Names on Magento Product Page

Displaying custom attributes grouped by their sets is a common requirement for enhancing user experience while browsing products. In Magento, your issue arises because the default product view template doesn’t include the attribute set logic you’ve configured in the admin panel.

Let’s walk through how to modify your theme to display these attribute group names on the frontend:

Step 1: Understanding Attribute Sets and Groups

In Magento, an Attribute Set is a collection of attributes that can be applied to products. Within each set, you can create Attribute Groups. These groups allow you to organize related attributes together.

For example, you might have an “Apparel” attribute set with the following groups:

  • Sizing
  • Color
  • Material

Step 2: The Default Product View Template

The default product/view.phtml template lists all attributed in a single table, regardless of their grouping. To change this behavior, we need to modify this file or create an override.

Note: Never edit core files directly! Instead, copy the required templates to your custom theme’s directory (app/design/frontend/<vendor>/<theme>/Magento_Catalog/templates/product).

Step 3: Modifying the Product View Template

Open your copy of product/view.phtml and locate the section where attributes are being rendered:

<?php $attributes = $block->getProductAttributes() ?>
<?php if ($attributes): ?>
    <div class="attr">
        <?php foreach ($attributes as $_attribute) : ?>
            <div class="label"><?= /* @escapeNotVerified */ $block->getAttributeLabel($_attribute.getId()) ?></div>
            <div class="value"><?= /* @escapeNotVerified */ $block->callChild('attribute', 'getValue', [$_attribute]) ?></div>
        <?php endforeach; ?>
    </div>
<?php endif; ?>

Step 4: Accessing Attribute Groups

To retrieve the attribute group information, we need to use Magento’s object manager. Note that this is a heavyweight approach and should be used sparingly.

First, include the Magento\Framework\ObjectManagerInterface class:

use Magento\Framework\ObjectManagerInterface;

Then, create a new object manager instance in your template file:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$groupFactory = $objectManager->create('Magento\Eav\Model\Entity\Attribute\Group');

Retrieve the current product’s attribute set ID and fetch the corresponding group collection:

$product = $block->getProduct();
$attributeSetId = $product->getData('entity_type_id');
$groupCollection = $groupFactory->fetchGroupCollection($attributeSetId);

Step 5: Displaying Attribute Groups

Modify your attribute rendering loop to include the group names:

<?php foreach ($attributes as $_attribute): ?>
    <?php $attributeSet = $objectManager->get('Magento\Eav\Model\Entity\Attribute\SetFactory')->create()->load($_attribute.getAttributeSetId());
    if ($groupCollection && count($groupCollection)): ?>
        <h3 class="group-name"><?= /* @escapeNotVerified */ $block->getAttributeGroupLabel($attributeSet.getGroup()) ?></h3>
    <?php endif; ?>

    <div class="label"><?= /* @escapeNotVerified */ $block->getAttributeLabel($_attribute.getId()) ?></div>
    <div class="value"><?= /* @escapeNotVerified */ $block->callChild('attribute', 'getValue', [$_attribute]) ?></div>
<?php endforeach; ?>

Conclusion

Displaying attribute groups on the product page requires a combination of retrieving the right data and modifying your theme’s templates.

Remember, always use proper version control when making changes to your theme files. It helps prevent issues during updates and allows for easier debugging.

For more detailed information about working with Magento themes and customization techniques, I recommend checking out our comprehensive guide on Magento Theme Development.

With this approach, you should now be able to display attribute groups effectively on your product pages without any additional extensions.

Catalog Database Themes Admin

Our network