I am trying to setup a single button to clear a list and replenish stock quantities

I am trying to replenish stock quantity of products in a list if a user clears their shopping cart from a single button, but to no avail, I can delete the list of items but can not figure out how to add the deleted items quantities back to their stock quantities I figured out how to do it individually for each product however, but as a list, “Totally Stumped” would appreciate any help.