When I am Trying to call Custom Template file test.phtml on product view page Template file i.e on wrapper.phtml template file is called but, when I am trying to output product details from my custom test.phtml I am unable to output,So any help how to get product details on my Custom test.phtml

File path:


<?php include ($block->getTemplateFile('Magento_Catalog::product/view/options/test.phtml')) ?>

My Custom Template File Path:


But I was unable to load product details when I write code on test.phtml file


  • Welcome to forum.Add more information about what we tried, whats your magento version and some code part – Mujahidh Feb 3 '17 at 5:30
  • In Magento 2 version – Learing_Coder Feb 3 '17 at 5:44
  • How you are trying to load product ??? can you explain – BornCoder Feb 3 '17 at 5:50
  • $productId = 8; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $currentproduct = $objectManager->create('Magento\Catalog\Model\Product')->load($productId);echo $currentproduct->getName(); when i am adding this in test.phtml, i was getting output, but when i try to put $_option = $block->getOption(); these lines and try to get details i am unable to output – Learing_Coder Feb 3 '17 at 6:16

Please try below code

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


$category = $objectManagerProduct->registry('current_product');

productId = $category->getId();

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

$currentproduct =

echo $currentproduct->getName();

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.