How to move reviews tab to the last in Magento 2?
You can just change inside details.phtml
template file and set as per your requirement tabbing order,
set details.phtml file inside your theme folder,
app/design/frontend/Packagename/themename/Magento_Catalog/templates/product/view/details.phtml
first print order of tabbing by,
<?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')):
echo "<pre>";print_r($detailedInfoGroup);
?>
**Now you have display your order tabbing in array.
you can just change your order by creating new array,**
<?php $newOrderTabbing = array('product.info.description','product.attributes','reviews.tab'); //custom add ?>
Inside foreach in this file, rename array name like instead of Code for details.phtml file,
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')):?>
<?php $newOrderTabbing = array('product.info.description','reviews.tab','product.attributes'); //custom add ?>
<div class="product info detailed">
<?php $layout = $block->getLayout(); ?>
<div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'>
<?php foreach ($newOrderTabbing as $name):?>
<?php
$html = $layout->renderElement($name);
if (!trim($html)) {
continue;
}
$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"
tabindex="-1"
data-toggle="switch"
href="#<?php /* @escapeNotVerified */ echo $alias; ?>"
id="tab-label-<?php /* @escapeNotVerified */ echo $alias;?>-title">
<?php /* @escapeNotVerified */ echo $label; ?>
</a>
</div>
<div class="data item content" id="<?php /* @escapeNotVerified */ echo $alias; ?>" data-role="content">
<?php /* @escapeNotVerified */ echo $html; ?>
</div>
<?php endforeach;?>
</div>
</div>
<?php endif; ?>
After adding above code now review tab display at the end of tab.
Finally Tab orders are display like Details, More Information,Review
.
Thanks.