I need to customize the message that is presented to the customer after his registration. I do not need to change only the message, but I need to show a different text if the user has checked a field in the registration form.

  • I think you need to override this controller vendor/magento/module-customer/Controller/Account/CreatePost.php Oct 22, 2019 at 4:03

1 Answer 1


You can use Observer here like


Content for this file is..

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="controller_action_predispatch_customer_account_createpost">
        <observer name="customer_account_create_post" instance="Vendor\Module\Observer\CreatePost" />


Content for this file is..

namespace Vendor\Module\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Exception\LocalizedException;

class CreatePost implements ObserverInterface
    protected $messageManager;

    public function __construct(
        \Magento\Framework\Message\ManagerInterface $messageManager
    ) {
        $this->messageManager = $messageManager;

    public function execute(\Magento\Framework\Event\Observer $observer)
        $condition = 'Your condition';

                __("Custom message here!")

        return $observer;

Hope this is helful to you!

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.