Hello Magento Friends,

In Magento 2, customizing the frontend order view page can greatly improve the user experience by allowing store owners to display additional information. Adding a custom tab is one of the ways to achieve this, where you can include custom content such as order notes, shipping information, or other customer-related details.

In this blog, we’ll walk through the steps to add a custom tab to the frontend order view page in Magento 2. This customization can be useful for various purposes, especially in B2B eCommerce stores where additional information is often needed.

Steps to Add a Custom Tab to the Frontend Order View Page in Magento 2:

Step 1: Create a “routes.xml” file inside our extension at the following path.

app\code\Vendor\Extension\etc\frontend\routes.xml

Now add the code as follows

Step 2: Create a “Mytab.php” file inside our extension at the following path.

app\code\Vendor\Extension\Controller\Order\Mytab.php

Now add the following code

Step 3: We need to create a sales_order_info_links.xml file inside our extension at the following path.

app\code\Vendor\Extension\view\frontend\layout\sales_order_info_links.xml

Then add the below-mentioned code

Step 4: Then, we need to create a taborderview_order_mytab.xml file inside our extension at the following path

app\code\Vendor\Extension\view\frontend\layout\taborderview_order_mytab.xml

Then after add the below code snippet

Step 5: Then, we need to create a custom_tab.phtml file inside our extension at the following path

app\code\Vendor\Extension\view\frontend\templates\custom_tab.phtml

Finally, add the following code

Output:

custom tab on frontend order view page Magento 2

Conclusion:

Adding a custom tab to the frontend order view page in Magento 2 is a straightforward process that enhances the order page’s functionality. Whether you need to display custom order notes, additional shipping details, or any other data, this customization offers flexibility and improves the user experience. By following this guide, you can easily add and modify custom tabs to meet your store’s unique needs.

Related Tutorial – 

How to add a Custom tab in Admin Sales Order view Magento 2

Happy Coding!

Click to rate this post!
[Total: 0 Average: 0]