1

I have created a custom tab on product page (just like details, more information, reviews). I want to show product attributes like quantity, color, price etc. under this custom tab.

Any help will be appreciated.

Thanks

6
  • @jigsparmar: i am not able to display product color, quantity and sku.
    – KamranKhan
    Commented Mar 16, 2018 at 10:37
  • Please log product all the data and check that product return all the data or not first Commented Mar 16, 2018 at 10:39
  • @jigsparmar: i didn't understand what you are trying to say.
    – KamranKhan
    Commented Mar 16, 2018 at 10:53
  • \Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->info("options", array('options data', $product->getData())); and check system.log file Commented Mar 16, 2018 at 10:59
  • @jigsparmar: what should i check in system.log file to resolve the issue.
    – KamranKhan
    Commented Mar 16, 2018 at 11:13

2 Answers 2

1

we write one blog for create tab in Product view Page in Frontend in https://magecomp.com/blog/how-to-add-custom-tab-in-magento-2-product-page/ page you found the code to create custom tab

1

app\code\Ravindra\Extension\view\frontend\templates\custom_tab.phtml

<?php // Get current product
$product = $block->getProduct();
?>

<h1 style="color: #ff5501">
 <?php echo $product->getData('quantity'); ?>
 <?php echo $product->getData('color'); ?>
 <?php echo $product->getData('price'); ?>
</h1>
1
  • i have implemented this, only price is displaying under custom but. Color and quantity are not displaying.
    – KamranKhan
    Commented Mar 16, 2018 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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