Sorry. Not talking about a cache plugin. All sites are cached in a browser almost always by default. You need to clear the cache to make sure you’re not constantly just refreshing an admin page.
Currently if the customer does not finalize the order it goes into status: failed. if I modify myself the status of the order status: canceled the order and directly remove.
Here’s what to do for orders: failed
1 – detected failed commands
2 – remove them completely from the site
However, you stated that “my code” works but not correctly. So I’m trying to assess and understand that statement. Is my code impeding on the default flow of a completed sale at all? Is it not placing it in the trash?