My other pages showing messages properly but not working on the product page. when I try to add to cart it does nothing. When I goto cart page it shows multiple time the success message. I tried by adding this to my catalog_product_view but no luck.

<referenceContainer name="page.messages">
        <block class="Magento\Framework\View\Element\Template" name="ajax.message.placeholder" template="Magento_Theme::html/messages.phtml"/>
        <block class="Magento\Framework\View\Element\Messages" name="messages" as="messages" template="Magento_Theme::messages.phtml"/>

Is there any way I can access the session or cookie messages programmatcially, so I can show them where I want? Thanks.

Note: I am using custom theme

  • there is a setting in the backen d that lets you display all blocks in the storefront. please verify that the messages block is rendered. If the block is not vissible you probably removed it somewhere in your layout xmls – Philipp Sander Jun 6 '18 at 9:34
  • Its shows Magento\Framework\View\Element\Messages this block but no message.You can check the url too for screenshot.prntscr.com/jrivp9 – Mahmood Rehman Jun 6 '18 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.