I have a cookie with 5 products. There will be a loop to read one by one and reduce from stock in database for each product. Now, If something goes wrong half way through i want to cancel whole transaction. For example; everything went ok for first 3 products and reduced the stocks for those products in database. If something goes wrong for product 4 then cancel transactions for first 3 products as well. Is this possible?
I am trying to understand the logic behind transaction is made in a loop.