How to place a new tab after the standard tabs on the frontend product view?

how to add new tab after product review tab?

already try with after=“reviews.tab”

Initial article: How to add a tab to the frontend product view?

<referenceBlock name="product.info.details">
	<block 
        class="Your\Module\Block\Class" 
		name="your.tab.name" 
		template="Your_Module::template.phtml" 
		group="detailed_info"
	/>
</referenceBlock>

I want add after review tab.

If i am adding using your xml file, it is adding on first place i want to add after all magento default tab.

Use the ‘after’ attribute.

please check my original message, already did but not working.

You are right, the after and before atributes does not work in this case because of the bug: The \Magento\Framework\Data\Structure::getGroupChildNames() ignores the children ordering

But there is another solution: use a proper modules sequence:

<module name='Your_Module' setup_version='2.0.0'>
	<sequence>
		<module name='Magento_Review'/>
	</sequence>
</module>

Do not forget to execute setup:upgrade after changing the modules sequence

Thanks for the solution but I think sequence to use for module dependency.

If we disable review module then our module tab will be not show right?

The modules sequences are for sequences, not for dependencies.
A module’s dependencies are declared in another way: How to declare the depencencies for a module?

The method with sequences will work with the Magento_Review module disabled.
See: How is the app/etc/config.php file generated by the \Magento\Setup\Model\Installer::createModulesConfig()?
A disabled module will just have 0 instead of 1 in the app/etc/config.php file.

1 Like

Thanks for the nice explanation.

A post was split to a new topic: How to move the “Reviews” tab to the first (leftmost) place?