Just tried your solution, everything works great. Prestashop 1.6.18
Only one question. If the product does not have a backorder and adding quantity in cart more then instock, then an error message. Is it possible to make a pop-up window, as it was before this modification?