I have created one custom attribute through code, in admin product edit page,but i wolud like to display that value in product detail page,
How to get the custom attribute collection in product detail page magento2.
i have tried with the below code but it is giving an error:
$_attributeValue = $_product->getResource()->getAttribute ($_code)->getFrontend()->getValue($_product);
Fatal error: Uncaught Error: Call to a member function getFrontend() on boolean in
Help me thankful
Thanks
Best Answer
Will give the custom attribute value if $_product is repository object.
If it is a model object you can refer to @Rakesh Donga's comment