I have a custom module, with a controller that apply discounts codes in payment page.

After the discount it's applied, I set a success message. Now this message it's showing on homepage, even I apply the discount on payment page. So to see the message I need to go on homepage. My controller where I set the message look like this:

                                    'You used coupon code "%1".',

Does anyone know how can I set the location for this message to be in checkout/payment page?

  • after setting sucees message, you can redirect customer to specific page. Feb 13, 2017 at 10:24
  • the customer shold be on the same page after the message apper Feb 13, 2017 at 10:28
  • You need to do that things. Or simple you can reload same page so message display on same page. Feb 13, 2017 at 10:29
  • you don't understand my question! i set a cusom discount on payment page, and my message apper on homepage. I need this message on payment page Feb 13, 2017 at 11:05
  • you need to check this, it may help you. magento.stackexchange.com/questions/158378/… Feb 13, 2017 at 12:04

1 Answer 1


Seem that you try to make an Ajax request to the custom controller in the Checkout Page. Your custom controller should return JSON format.

        $response = [
            'errors' => false,
            'message' => 'The coupon code was applied.'

    $resultJson = $this->_resultJson->create();
    return $resultJson->setData($response);

In your Js function, you need to get the response message and show it. We can follow the Coupon form on the checkout page.


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.