Magento as an E-commerce platform has the power to extend the native core functionalities which keep Magento away from the competition. One of the most effective default functionality is admin notifications. Magento uses admin notifications in the store backend to notify admin about various upgrades, patches, notice or errors which is required to grab the attention.

Whenever you login to admin panel, such notifications may appear giving you some important information. Have you ever think about adding custom notification in your Magento 2 extensions? You may require to add custom notification in Magento 2 to inform admin about latest upgrade, installation information, news related to it or any useful piece of content to get them notified about. Default Magento u2 contains four severity types of notification messages in Magento.

Notice – updates, releases and other Magento news
Minor – minor updates and other messages
Major – important notifications, which you should check shortly
Critical – vulnerability issues and other most important notifications

Recently we came across the requirement of Adding Custom Admin Notification in Magento 2 and we nailed the solution by developing custom code for it. Today we’re sharing the same code to help you out adding your custom notification in your own module .

Firstly, you need to create “di.xml” file at App\code\Vendor\Extension\etc\adminhtml with below code.

Once the file is created, you need to create another file at App\code\Vendor\Extension\Model\Admin\Quote\ with below code and name it as “Messages.php”.

Woot, you have successfully added admin notification. Not only this, you can customize this code to meet certain conditions as per your need. You can even change notification type like default Magento by using following values to your code.

SEVERITY_CRITICAL– to add critical message
SEVERITY_MAJOR– to add major message
SEVERITY_MINOR– to add minor message
SEVERITY_NOTICE– to add notice

I hope you can now add Custom Admin Notification in Magento 2 using the above piece of code. But If you still have any confusions or questions regarding this code, just leave a comment below and I will get back to you! Don’t forget to hit the stars and share the blog with other magento folks.
Until that, Happy Coding!

Click to rate this post!
[Total: 10 Average: 4.5]