Automatically cancel magento 2 pending orders after a specified amount of time?

by Kevin   Last Updated August 13, 2019 18:09 PM

We found that we sometimes run out of stock/inventory due to orders pending payment. Is there a way to "release" those stock/inventory after a specified amount of time, automatically, without us having to check regularly for orders pending payment and cancelling manually?



Answers 2


One of the solutions is to create a cron job that will cancel the orders left waiting for payment X hour or days after they were created.
That way your stocks would be updated.

Here you can find explanations and examples on how to configure and create cron tasks :
- https://www.maximehuran.fr/en/create-a-cron-job-with-magento-2/
- https://www.atwix.com/magento-2/setting-up-cron-jobs/
- http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

Here it is same logic for Magento 1 : How to automatically cancel pending orders after a specified amount of time?

Matthéo Geoffray
Matthéo Geoffray
January 19, 2017 12:56 PM

you can see some magento 2 extension provider company selling magento 2 auto cancel order extension you can check this https://www.mageants.com/auto-cancel-order-for-magento-2.html if your requirement fulfil with this

Dhiren
Dhiren
August 13, 2019 18:01 PM

Related Questions


Updated March 08, 2019 13:09 PM

Updated March 27, 2019 21:09 PM

Updated August 14, 2018 11:09 AM

Updated June 18, 2019 10:09 AM

Updated November 09, 2016 08:03 AM