{"id":723,"date":"2019-12-20T13:09:43","date_gmt":"2019-12-20T13:09:43","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/12\/20\/reorder-product-tabs-in-magento-2\/"},"modified":"2025-07-23T09:34:22","modified_gmt":"2025-07-23T04:04:22","slug":"reorder-product-tabs-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/reorder-product-tabs-in-magento-2\/","title":{"rendered":"How To Reorder Product Tabs In Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A product page design in E-commerce is important as a potential customer is going to search for the product and not a brand in most of the cases. Moreover, product pages are the ones that are going to be shared maximum on social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An eCommerce page design plays a significant role to create the right visual effect, generate lead and conversion.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, an easy to follow design can enhance the users\u2019 shopping experience!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When it comes to Magento 2, while developing a store, you may need to tweak the design of the default pages. It is to optimize the page for the better shopping experience and intrigue the visitors to stay on the page. You can also <a href=\"https:\/\/meetanshi.com\/blog\/move-related-products-above-product-tabs-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">move related products above product tabs in Magento 2<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>Reorder product tabs in Magento 2<\/strong><\/em> as shown below:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Before:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/12\/Product-tabs-in-Magento-2-Meetanshi-1024x377.png\" alt=\"Before - Product Tabs in Magento 2\" class=\"wp-image-7003\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>After:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/12\/Reordered-product-tabs-in-Magento-2-Meetanshi-1024x378.png\" alt=\" After - Product Tabs in Magento 2\" class=\"wp-image-7004\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Method to reorder product tabs in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create\/change the file at <\/p>\n\n\n\n<p class=\"has-small-font-size wp-block-paragraph\"><em><strong>app\/design\/frontend\/Vendor\/Theme\/Magento_Catalog\/layout\/catalog_product_view.xml<\/strong><\/em><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;referenceBlock name=\"product.info.details\">\n        &lt;referenceBlock name=\"product.info.description\">\n            &lt;arguments>\n                &lt;argument name=\"priority\" xsi:type=\"string\">1&lt;\/argument>\n            &lt;\/arguments>\n        &lt;\/referenceBlock>\n        &lt;referenceBlock name=\"product.attributes\">\n            &lt;arguments>\n                &lt;argument name=\"priority\" xsi:type=\"string\">3&lt;\/argument>\n            &lt;\/arguments>\n        &lt;\/referenceBlock>\n        &lt;referenceBlock name=\"reviews.tab\">\n            &lt;arguments>\n                &lt;argument name=\"priority\" xsi:type=\"string\">4&lt;\/argument>\n            &lt;\/arguments>\n        &lt;\/referenceBlock>\n        &lt;!-- Your Custom Tab -->\n        &lt;block class=\"Magento\\Catalog\\Block\\Product\\View\\Description\" name=\"product.features\" as=\"features\" template=\"product\/view\/features.phtml\" group=\"detailed_info\">\n            &lt;arguments>\n                &lt;argument translate=\"true\" name=\"title\" xsi:type=\"string\">Custom Tab&lt;\/argument>\n                &lt;argument name=\"priority\" xsi:type=\"string\">2&lt;\/argument>\n            &lt;\/arguments>\n        &lt;\/block>\n    &lt;\/referenceBlock><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">2. If&nbsp;<em><strong>details.phtml<\/strong><\/em> file does not exist in Theme directory then<br>copy from<\/p>\n\n\n\n<p class=\"has-small-font-size wp-block-paragraph\"><strong><em>vendor\/magento-catalog-view\/frontend\/templates\/product\/view\/details.phtml<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">to<\/p>\n\n\n\n<p class=\"has-small-font-size wp-block-paragraph\"><em><strong>app\/design\/frontend\/Vendor\/Theme\/Magento_Catalog\/templates\/product\/view\/details.phtml<\/strong><\/em><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/**\n * Copyright \u00a9 2016 Magento. All rights reserved.\n * See COPYING.txt for license details.\n *\/\n\n\/\/ @codingStandardsIgnoreFile\n\n?>\n&lt;?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')):?>\n    &lt;div class=\"product info detailed\">\n        &lt;?php $layout = $block->getLayout(); ?>\n        &lt;?php\n            # We create a new array;\n            $newPriority = array();\n            # forEach the original $detailedInfoGroup Array;\n            foreach ($detailedInfoGroup as $name){\n                $alias = $layout->getElementAlias($name);\n                # Get the priority which we applied via xml file\n                # If no priority is applied via xml file then just set it to 10\n                $priority = $block->getChildData($alias,'priority') ? $block->getChildData($alias,'priority') : '10';\n                # variables pushed into new two-dimensional array\n                array_push($newPriority, array($name, $priority));\n            }\n            # Sort array by priority\n            usort($newPriority, function($a, $b) {\n                return $a['1'] &lt;=> $b['1'];\n            });\n        ?>\n        &lt;div class=\"product data items\" data-mage-init='{\"tabs\":{\"openedState\":\"active\"}}'>\n            &lt;?php\n            # Delete the original forEach statement\n            #foreach ($detailedInfoGroup as $name)\n            foreach ($newPriority as $name):?>\n                &lt;?php\n                    # rename $name[0] to $name because it's a two-dimensional array\n                    # No further changes to this file, it works as explained\n                    $name = $name[0];\n                    $html = $layout->renderElement($name);\n                    if (!trim($html)) {\n                        continue;\n                    }\n                    $alias = $layout->getElementAlias($name);\n                    $label = $block->getChildData($alias, 'title');\n                ?>\n                &lt;div class=\"data item title\"\n                     aria-labeledby=\"tab-label-&lt;?php \/* @escapeNotVerified *\/ echo $alias;?>-title\"\n                     data-role=\"collapsible\" id=\"tab-label-&lt;?php \/* @escapeNotVerified *\/ echo $alias;?>\">\n                    &lt;a class=\"data switch\"\n                       tabindex=\"-1\"\n                       data-toggle=\"switch\"\n                       href=\"#&lt;?php \/* @escapeNotVerified *\/ echo $alias; ?>\"\n                       id=\"tab-label-&lt;?php \/* @escapeNotVerified *\/ echo $alias;?>-title\">\n                        &lt;?php \/* @escapeNotVerified *\/ echo $label; ?>\n                    &lt;\/a>\n                &lt;\/div>\n                &lt;div class=\"data item content\" id=\"&lt;?php \/* @escapeNotVerified *\/ echo $alias; ?>\" data-role=\"content\">\n                    &lt;?php \/* @escapeNotVerified *\/ echo $html; ?>\n                &lt;\/div>\n            &lt;?php endforeach;?>\n        &lt;\/div>\n    &lt;\/div>\n&lt;?php endif; ?><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Change the order of the tabs on the product page in Magento 2 store. Tweak the design of the product page based on buyer persona and content relevancy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do share the solution with the fellow developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A product page design in E-commerce is important as a potential customer is going to search for the product and not a brand in most&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-723","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=723"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/723\/revisions"}],"predecessor-version":[{"id":19083,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/723\/revisions\/19083"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}