Magento – System Error/Success messages are not displaying in custom theme

magento2

I have created a simple custom theme which has dependency on Magento/blank

Everything in my theme works good except that whenever I add any error/success messages to the messageManager in my custom module and do a redirect to the custom page displaying a form.

It doesn't display those messages.

What I Did

\Magento\Framework\Message\ManagerInterface $messageManager is injected in the constructor

$this->messageManager->addError('Invalid details provided.'); added this in my controler action's execute method

$this->_redirect('myorders/uploadorder/index'); doing a redirect to the page where the form is displayed

What I have already refereed in stack exchange

Magento 2 : success messages are not showing

How to use messageManager to show an error after redirect

Magento 2: Ensure Message Manager Messages Show Up After a Redirct

Best Answer

From what I can see with what your posting it doesn't seem to be an issue with the functional more the theme or 3rd party extension removing the message block or you have a js conflict which is preventing it

In my case it was a 3rd party application causing a it to reset the message cookie check in chome cookies and see if the response is being set and reset if so it's most likely a module which is causing the message to be unset

Related Topic