Correction at the time of paying if stock of the items = 0

At the time of paying if the stock of the article passes in 0
redirect to cart
You have to verify the return type. If it's a reponse, return it. Otherwise do nothing.