free
web stats

Fill the form & Get Installation Support

Connect With Us





captcha

Connect With Us





captcha

How to display types of messages using ManagerInterface Magento 2

Magento 2 use show Success and Error Message Using Interface Magento\Framework\Message\ManagerInterface.

You can set success message Using addSuccessMessage( ) and set error message using addErrorMessage( )function.

You can directly fetch Object of Magento\Framework\Message\ManagerInterface in controller file but for other files like Plugin, Observer, Model, Block or Helper; you need to instantiate an object in your __construct( ) method.

Now you can set messages like below:

 

Was this article helpful?
YesNo
Fill the below form if you have any Magento programming need.




captcha