Magento 2 – How to Show Brand Name on Product Page

magento-2.1product-attribute

I want to show brand name in product details page above product name.So I want to write code in title.phtml.I wrote like this

      $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

      $productBlock = $objectManager->create('\Magento\Catalog\Block\Product\View\AbstractView');
      $product = $productBlock->getProduct();

      $product->getAttributeText('manufacturer');

but nothing shows.
How do I achieve this?

Best Answer

Use following code it may be helps use

  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

  $productBlock = $objectManager->create('\Magento\Catalog\Block\Product\View\AbstractView');
  $product = $productBlock->getProduct();

  $product->getResource()->getAttribute($code)->getFrontend()->getValue($product); 
Related Topic