0

This question might be asked here before. I have checked many threads but couldn't find a solution for my problem. I have a custom Magento 2.1.7 theme. In my website the success/error messages not showing. Initially, I thought it would be the issue of my custom theme. Then I switched the design to default 'luma' theme. Now also the success/error message not showing. Can any one help me to sort it out?

Edit *

I could find that message wrapper is loading, but the message texts are not fetching. I am here attaching the out put html of message wrapper

    <div class="page messages"><div data-placeholder="messages"></div>
<div data-bind="scope: 'messages'">
    <div data-bind="foreach: { data: cookieMessages, as: 'message' }" class="messages">
        <div data-bind="attr: {
            class: 'message-' + message.type + ' ' + message.type + ' message',
            'data-ui-id': 'message-' + message.type
        }">
            <div data-bind="html: message.text"></div>
        </div>
    </div>
    <div data-bind="foreach: { data: messages().messages, as: 'message' }" class="messages">
        <div data-bind="attr: {
            class: 'message-' + message.type + ' ' + message.type + ' message',
            'data-ui-id': 'message-' + message.type
        }">
            <div data-bind="html: message.text"></div>
        </div>
    </div>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                        "messages": {
                            "component": "Magento_Theme/js/view/messages"
                        }
                    }
                }
            }
    }
</script>
</div>
2
  • disable the full page cache in back end and check whether it's working or not Commented Oct 10, 2017 at 6:50
  • I have disabled the full page cache with command line and it was already disabled. Still couldn't get the messages.
    – hakkim
    Commented Oct 17, 2017 at 10:37

1 Answer 1

0

I just saw a similar issue in one of my Magento2 projects.

In my case, it turned out to be a custom module changing the functionality of setting and retrieving cookies in Magento.

Long story short... these messages are stored in a cookie called mage-messages

Then the message is retrieved and the cookie cleared as we can see here

 // vendor/magento/module-theme/view/frontend/web/js/view/messages.js

 /**
 * Extends Component object by storage observable messages.
 */
initialize: function () {
    this._super();

    this.cookieMessages = _.unique($.cookieStorage.get('mage-messages'), 'text');
    this.messages = customerData.get('messages').extend({
        disposableCustomerData: 'messages'
    });

    // Force to clean obsolete messages
    if (!_.isEmpty(this.messages().messages)) {
        customerData.set('messages', {});
    }

    $.cookieStorage.set('mage-messages', '');
},

mage-messages cookie I would recommend looking at this when debugging an issue related to these messages not showing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.