My product page has 3 tabs (Details, More information, Reviews). When you go to the product page the Details tab is initially open. I'd like to be able to link directly to second tab (More information). problem is that url like #additional works only when this tab is opened.

Will really appreciate if someone guide me how to compose right link.

  • You mean you need to open the More information tab opened by default? Oct 5, 2018 at 11:51
  • no, only when user will click on particular link.
    – bofh
    Oct 5, 2018 at 11:57
  • And where this link will located in product details page? Oct 5, 2018 at 12:27

1 Answer 1


You need to set a priority of attributes and override catalog_product_view.xml

<referenceBlock name="product.info.details">
    <referenceBlock name="product.info.description">
            <argument name="priority" xsi:type="string">1</argument>
    <referenceBlock name="product.attributes">
            <argument name="priority" xsi:type="string">3</argument>
    <referenceBlock name="reviews.tab">
            <argument name="priority" xsi:type="string">4</argument>

After you need to do few workouts at details.phtml so copy from


To your custom extension

<?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')):?>
<div class="product info detailed">
    <?php $layout = $block->getLayout(); ?>
        $newPriority = array();
        foreach ($detailedInfoGroup as $name){
            $alias = $layout->getElementAlias($name);
            $priority = $block->getChildData($alias,'priority') ? $block->getChildData($alias,'priority') : '10';
            array_push($newPriority, array($name, $priority));
        usort($newPriority, function($a, $b) {
            return $a['1'] <=> $b['1'];
    <div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'>
        foreach ($newPriority as $name):?>
                $name = $name[0];
                $html = $layout->renderElement($name);
                if (!trim($html)) {
                $alias = $layout->getElementAlias($name);
                $label = $block->getChildData($alias, 'title');
            <div class="data item title"
                 aria-labeledby="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>-title"
                 data-role="collapsible" id="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>">
                <a class="data switch"
                   href="#<?php /* @escapeNotVerified */ echo $alias; ?>"
                   id="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>-title">
                    <?php /* @escapeNotVerified */ echo $label; ?>
            <div class="data item content" id="<?php /* @escapeNotVerified */ echo $alias; ?>" data-role="content">
                <?php /* @escapeNotVerified */ echo $html; ?>
        <?php endforeach;?>

Please review above thread and made changes as per your need. I hope it will helpful.

Thanks, Sam

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.