Web Analytics

Fill the form & Get Installation Support

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:

 

Fill the below form if you have any Magento programming need.





    Recent Articles

    Author Info

    Author Image

    Magento Developer

    Hire T. Baldha

    Get a Free Quote





      /* second popup */

      Connect With Us