1

When a new order is create and the customer has checked the Subscribe to Newsletter box, below is how the checkout/onepage/success page appears.

enter image description here

I will like to change the text Thank you for your subscription. to something different.

I have searched I located the text string here magento/module-newsletter/Controller/Subscriber/NewAction.php. I tested it by change the text on this method getSuccessMessage(int $status): Phrase{} but it did not change on frontend.

When I look at the page source code I could see it is going from a cookie message below.

    <!-- ko if: cookieMessages && cookieMessages.length > 0 -->
    <div role="alert" 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
        }" class="message-success success message" data-ui-id="message-success">
            <div data-bind="html: $parent.prepareMessageForHtml(message.text)">Thank you for your subscription.</div>
        </div>
    </div>
    <!-- /ko -->

    <!-- ko if: messages().messages && messages().messages.length > 0 --><!-- /ko -->

I could not figure out how I can change it. I am still new to Magento 2. I will appreciate it if anyone can point me in right direction.

1 Answer 1

0

Newsletter Success Message comes from this file :

Magento\Newsletter\Controller\Subscriber\NewAction

If you open this file, there is function called private function getSuccessMessage which return this message.

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.