0

Magento shows custom attributes in the first tab after product main information.

Inside this tab I have some custom attributes that I would like to show in other place of the page (under sku for example).

How can I do this?

2

First of all, you need to disable the show in frontend in Magento admin Catalog / Attributes / Manage attributes -> edit attribute -> disable the option. This way it will not show up in the default tab.

If you want to add it for instance with the sku add it in the template app/design/frontend/{TEMPLATE}/default/template/catalog/product/view.phtml

Sku

<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

Custom attribute

<?php echo $_helper->productAttribute($_product, $_product->getMyCustomAttribute(), 'my_custom_attribute') ?>
| improve this answer | |
  • Jeroen, any idea what the "Used in Product Listing" option does? – thdoan Oct 13 '16 at 8:48
  • If the custom attribute code above doesn't work for you in v2.2.1, try this code instead: $_product = $block->getProduct(); $value = $_product->getResource()->getAttribute('my_custom_attribute')->getFrontend()->getValue($_product); – thdoan Oct 13 '16 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.