---
title: "How to add custom Button on Admin Sales Order View page in Magento 2?"
url: "https://magecomp.com/blog/add-custom-button-admin-sales-order-view-page-magento-2/"
date: "2019-02-11T16:28:51+00:00"
modified: "2025-02-21T06:56:33+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 413
reading_time: "3 min read"
summary: "For small Businesses, Order is like a heartbeat that makes it alive. Once an order is placed the real war for the store owner is begin to ensure successful order delivery by making the customer hap..."
description: "For small Businesses, Order is like a heartbeat that makes it alive. Several times while checking order you think that what if there is such an option, you c..."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "[Solved] Magento 2: Currency Symbol not Showing on Product, Cart and Checkout Page"
    url: "https://magecomp.com/blog/solved-magento-2-currency-symbol-not-showing/"
  - title: "How to add Custom CSS Stylesheet using the block in Magento 2?"
    url: "https://magecomp.com/blog/add-custom-css-stylesheet-using-block-magento-2/"
  - title: "How to Use Resource Picker using Shopify App Bridge API in Shopify Remix App?"
    url: "https://magecomp.com/blog/use-resource-picker-using-shopify-app-bridge-api/"
---

# How to add custom Button on Admin Sales Order View page in Magento 2?

_Published: February 11, 2019_  
_Author: Dhiren Vasoya_  

![Magento 2 How to add custom Button on Admin Sales Order View page1](https://magecomp.com/blog/wp-content/uploads/2019/02/Magento-2-How-to-add-custom-Button-on-Admin-Sales-Order-View-page1-1024x332.webp)

For small Businesses, Order is like a heartbeat that makes it alive. Once an order is placed the real war for the store owner is begin to ensure successful order delivery by making the customer happy. CMS like Magento plays a vital role to collect and manage all that’s required customer information in one place. The Magento Sales order view is the most critical area for the store owner to work with where they can see complete order details like name, contact details, shipping and billing address, payment methods they have used etc.

[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-6.webp)](https://magecomp.com/services/hyva-theme-development/)
As business varies, several times you think that what if there is such option, therefore, I can save my time to complete things before time and that’s how Magento Custom Development comes into the picture. Till date, we have received so many requests for customizing sales order view section to make stuff easier for the store owner. So, we decided to share one small trick that will help you to ***add custom Button on the Admin Sales Order View page in Magento 2***.
Simply follow this to steps and you are done!
Firstly, we have to create “**di.xml**” file inside our custom extension folder using below code.
**app\code\Vendor\Extension\etc\adminhtml\di.xml**

```
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoSalesBlockAdminhtmlOrderView">
        <plugin name="Vendor_Extension::sendOrderView" type="VendorExtensionPluginPluginBtnOrderView" />
    </type>
</config>
```

[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-2.webp)](https://magecomp.com/services/hire-magento-programmer/)

Now the second and last step create New Block file and named it “**PluginBtnOrderView.php**” at this following path using below code.
**app\code\Vendor\Extension\Plugin\PluginBtnOrderView.php**

```
<?php

namespace VendorExtensionPlugin;

use MagentoBackendModelUrlInterface;
use MagentoFrameworkObjectManagerInterface;

class PluginBtnOrderView
{
    protected $object_manager;
    protected $_backendUrl;

    public function __construct(
        ObjectManagerInterface $om,
        UrlInterface $backendUrl
    ) {
        $this->object_manager = $om;
        $this->_backendUrl = $backendUrl;
    }

    public function beforeSetLayout( MagentoSalesBlockAdminhtmlOrderView $subject )
    {
        $sendOrder = $this->_backendUrl->getUrl('sales/send/order/order_id/'.$subject->getOrderId() );
        $subject->addButton(
            'sendordersms',
            [
                'label' => __('Custom BUTTON SMS'),
                'onclick' => "setLocation('" . $ sendOrder. "')",
                'class' => 'ship primary'
            ]
        );

        return null;
    }

}
```

That’s it. Simply clear cache and you will able to find your custom button under the hood of sales order view section in your Magento 2 backend.
Let us know if you are facing an issue while implementing using this code by commenting below.

[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-3.webp)](https://magecomp.com/services/magento-upgrade-services/)
Happy Coding!


---

_View the original post at: [https://magecomp.com/blog/add-custom-button-admin-sales-order-view-page-magento-2/](https://magecomp.com/blog/add-custom-button-admin-sales-order-view-page-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-31 11:17:37 UTC_  
