Magento 2 Add Anchor link to Success or Error Message.

You can add anchor tag link in success message, an error message or any notification message in Magento 2 by addSuccess( ), addError( ) and addNotice( ) respectively.

Let’s we add a link to Shopping cart of a product successfully added to cart.

You can add your message under the addSuccess( ) function. If you want to add custom link in error message you need to use addError( ) function to display link.

link in custom message
add custom link in a success message

Leave a Reply

Your email address will not be published. Required fields are marked *