I want to add link in cart added message
Make shopping Cart as link
In checkout cart add controller i am changing message like this
$message = __(
'You added %1 to your <a href ="..">shopping cart</a>.',
$product->getName()
);
but its getting text when i look in console its come from knockout js and they are getting html "html: message.text"
of message but its getting like text
How can i change it
Best Answer
HTML is not allowed by default in flash messages and it's escaped. To change this you can use
addSuccess()
method instead ofaddSuccessMessage()
to create message.It can be done by creating plugin for
Magento\Checkout\Controller\Cart\Add
controller. I would avoid overwriting wholeexecute()
method only for this small change and rather use the following: