Woocommerce Programmatically Cancel Pending Orders After 1 Hour

Post Category:

PhP, Woocommerce

Table of Contents

Learn how conditionally cancel pending orders periodically within 1 hour.

YouTube tutorial:

YouTube link will be available soon.

More Info:

You may wonder – “but I can already do that from the WooCommerce settings! “. Yes, that’s correct; go to WooCommerce Settings > Products > Inventory and set the “Hold Stock Minutes” value. After that period, unpaid orders will be marked as cancelled to make sure the stock goes back to the initial value. The problem is – what if you don’t want to use the “Hold Stock Minutes” thing, and even better, what if you don’t use stock management at all? In that case, orders won’t be marked as cancelled automatically. Also, what if you need to do conditional work e.g., you only want to cancel “failed” orders, while you want to keep “pending” ones as they are? Even in this case, the “hold stock” option won’t work, as you need to specify which order status you want to target and then run the cancel function.

Login To Access Code Snippet:

You Also Like This:



Features added:
Conditionally cancel pending orders periodically; within one hour.

Subscribe To Our Newsletter:

Stay UpTo Date with Latest Post And news:

Support us:
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x

Stay UpTo Date with Latest Post And news: