How to Add a Custom Admin Notice

We all have seen several notices or system messages that are shown from time to time in Magento admin. In this post we will see together how easily you can add a fixed custom notice in Magento admin.

The Backend Magento module is the one responsible for showing these notices. By default there are two that can be shown under circumstances. The first notice is about enabling JavaScript in our browser and the second about the information that the shop is a demo shop. Additionally to those notices, we can simple add out custom one by editing the template used.

The simplest way is to copy the template vendor/magento/module-backend/view/adminhtml/templates/page/notices.phtml to our adminhtml theme, so can be easily overridden. The second way is to create a simple module where you can the same thing.

The template file should look like the one below.

In case you create your own module, meaning that you followed the second way, then you will need a layout update to override the template file.

Now the admin page will look like below.

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