I wanted to have addtocart button on message template for back in stock template.

Any ideas, how it can be done.

right now I have done customization and replicated AddProductToCart_Catalog method. and have added a new maproute that calls the duplicated method.

and have made some changes in the new created method due to which the product is being added to the cart.
But in case of warning it returns json data with message and success parameters. I do not understand how to handle it.

Please if someone can guide me.
and if this approach is wrong and it can be done in a simpler way do let me know, since this I am pretty new to Nopcommerce.

Thanks in advance.