I want to change the Success Message in the Contact Page. After someone press the submit button the Success page is like this:

enter image description here

How I can to change the Success Page to display a static block for example or to be something like this:

enter image description here

  • @GosuPrzmak you have read my post? I ask about Contact Success page, what you send me is about Order Success page, this two things are very very different.
    – Robert
    Commented Feb 11, 2020 at 22:56
  • my bad robert i will take a look tomorrow :) Commented Feb 11, 2020 at 23:34

1 Answer 1


I think for your requirement you need to overwrite the Magento_Contact Post controller. By default Magento_Contact module redirects to contact/index after you submit the Contact Form. Follow these steps to overwrite.

Added to your custom module di.xml

<preference for="Magento\Contact\Controller\Index\Post" type="[Name Space]\[Your Module]\Controller\Contact\Post" />

Create the custom controller class


namespace [Name Space]\[Your Module]\Controller\Contact\Post;

class Post extends \Magento\Contact\Controller\Index\Post


public function execute($coreRoute = null)


    if (!$this->getRequest()->isPost()) {
        return $this->resultRedirectFactory->create()->setPath('*/*/');
    try {
            __('Thanks for contacting us with your comments and questions. We\'ll respond to you very soon.')
    } catch (LocalizedException $e) {
    } catch (\Exception $e) {
            __('An error occurred while processing your form. Please try again later.')
    return $this->resultRedirectFactory->create()->setPath('<Your Module Frontend Page Path>');


"Your Module Frontend Page Path" something like custom-module/success

Refer the class for details.


By overwriting the execute function you re-direct to the new custom page template.

How to create a Custom Page

Please check here.

Hope this answer is helpful.

  • Hi thank you so much for your answer, I have a request to you, can you add the code how we can do the redirect, because in fact this is my question, to overwrite a module I know but I want to know how I can made that redirect to a new .phtml or static block, thank you in advance
    – Robert
    Commented Feb 12, 2020 at 7:13
  • @Robert updated please have a look now. Commented Feb 12, 2020 at 7:53
  • thank you very much, can you tell me please how this code redirect the success page to a static block?
    – Robert
    Commented Feb 12, 2020 at 8:57
  • If you using the default contact form page then this overwrite controller will handle the post form request. At first it will do all the necessary stuff of sending email or any error message. Then last line of the function will redirect to your Custom Page which is loading the static block. @Robert Commented Feb 13, 2020 at 7:23

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.