0

I want to move product attributes inside the more Information tab. enter image description here

Can someone help?

1

I am assuming your attribute code is external_link

Now copy:

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

to

app/design/frontend/{Package}/{theme}/Magento_Catalog/templates/product/view/attributes.phtml

Now we will add an if condition for external_link code and add a tag like:

<?php if($_data['code']=='external_link') { ?>
        <tr>
            <th class="col label" scope="row"><?= $block->escapeHtml("Manufacturer Webpage") ?></th>
            <td class="col data" data-th="<?= $block->escapeHtmlAttr($_data['label']) ?>"><a href="<?= /* @noEscape */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>">More Detail</a></td>
        </tr>
    <?php } else{?>
    <tr>
        .... code for other attribute
    </tr>
<?php } ?>

full file code would be:

<?php
    $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
    $_product = $block->getProduct();
?>
<?php if ($_additional = $block->getAdditionalData()) :?>
    <div class="additional-attributes-wrapper table-wrapper">
        <table class="data table additional-attributes" id="product-attribute-specs-table">
            <caption class="table-caption"><?= $block->escapeHtml(__('More Information')) ?></caption>
            <tbody>
            <?php foreach ($_additional as $_data) :?>
                <?php if($_data['code']=='external_link') { ?>
                    <tr>
                        <th class="col label" scope="row"><?= $block->escapeHtml("Manufacturer Webpage") ?></th>
                        <td class="col data" data-th="<?= $block->escapeHtmlAttr($_data['label']) ?>"><a href="<?= /* @noEscape */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>">More Detail</a></td>
                    </tr>
                <?php } else{?>
                <tr>
                    <th class="col label" scope="row"><?= $block->escapeHtml($_data['label']) ?></th>
                    <td class="col data" data-th="<?= $block->escapeHtmlAttr($_data['label']) ?>"><?= /* @noEscape */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
                </tr>
            <?php } ?>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
<?php endif;?>

Hope above will help!

5
  • I added full file code in attributes.phrml but not working.
    – gill
    Jul 28 '20 at 11:03
  • did you changed attribute code ?
    – Pawan
    Jul 28 '20 at 11:12
  • Yes, only need to change attribute code.
    – gill
    Jul 28 '20 at 12:05
  • if you changed attribute code, make sure your you template override working. for test add code to core file OR Add additional class to any div and check it.
    – Pawan
    Jul 28 '20 at 12:38
  • Thank you so much.
    – gill
    Jul 28 '20 at 12:56

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.