1

How Magento2 is hiding tab if there is no data in it, on frontend product page?
For example : product description is appearing in first tab, but if there is no data in description, then description tab is not appearing on frontend.
How Magento is doing this and which code is responsible for this?
I want to achieve same but on some other custom condition.

2 Answers 2

3

I have taken reference from vendor/magento/module-catalog/view/frontend/templates/product/view/attribute.phtml and found Magento is using condition <?php if ($_attributeValue): ?>
I have appended my custom condition in same if condition code in my custom module custom template file.

0

You can check below file for product detail page tab

File path :

vendor/magento/module-catalog/view/frontend/templates/product/view/attribute.phtml

You can see below condition in this file.

This condition is handle for hide tab if data if there is a no data

<?php if ($_attributeValue): ?>

<?php endif;?>

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.