Add a Custom Button to Admin Sales Order View

Would you like to add a custom button to admin sales order view? Let's do how you can easily do that by creating a Magento 2 plugin!

The best way to do that is by creating a Magento 2 plugin to extend the behavior of the public function setLayout of the class


So first of all we have to declare our plugin in the di.xml file like below

and then extend this function using the before method and add our button.

Simple as that! So now the admin sales order view will look like

The full example as extension can be found here.

Feel free to share this post and ask your questions in the comments below.

Till next time!

DigitalOcean Referral Badge