-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pending Payment Order Lifetime & sales_clean_orders Cronjob Conflict? #37878
Comments
Hi @drinkingsouls. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
@magento give me 2.4-develop instance |
Hi @drinkingsouls. Thank you for your request. I'm working on Magento instance for you. |
Hi @drinkingsouls, here is your Magento Instance: https://b58b3f0843b51ebd1c286fc967a00a2c.instances-prod.magento-community.engineering |
Can't be replicated on Dev Instance as there is no Payment Gateway to set "Pending Payment" status to an order. |
Hi @engcom-Dash. Thank you for working on this issue.
|
Looks like similar issue to #23682 To simplify, the "Pending Payment Order Lifetime (minutes)" setting is in conflict with the sales_clean_orders cron that only runs once an hour. If anything less than 60 minutes is set for "Pending Payment Order Lifetime (minutes)", it doesn't cancel Pending Payment orders because it has to wait for the sales_clean_orders cron to be run hourly. |
Hi @engcom-Bravo. Thank you for working on this issue.
|
Hi @drinkingsouls, Thank you for reporting and collaboration. Verified the issue on Magento 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots. Steps to reproduce
Pending Payment orders are not Closed when time value set is reached. Hence Confirming the issue. Thanks. |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-9466 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Bravo. Thank you for verifying the issue. |
Pending Payment orders are not closed when time value set is reached. That is the problem. |
Hello Team, We observe the following issue.
I have checked the following article https://magento.stackexchange.com/questions/280686/pending-payment-order-lifetime-doesnt-expire-or-cancel-orders where it says that:
In admin panel of Adobe Commerce (known as Magento) here is what configuration have been settled. The questions that we have as exposed as follows.
Default order states in Magento include: "Pending Payment" – assigned to an order for which the payment has been initiated but is awaiting confirmation. Regards, |
Preconditions and environment
The sales_clean_orders cronjob is run every hour, on the hour. This is set it in the crobtab.xml at vendor/magento/module-sales/etc
<job name="sales_clean_orders" instance="Magento\Sales\Model\CronJob\CleanExpiredOrders" method="execute"> <schedule>0 * * * *</schedule> </job>
This cancels orders with "Pending Payment" status correctly. However, it does this once per hour, as set by the cron.
There is a setting to reduce order pending lifetime in Stores > Configuration >Sales > Sales > Orders Cron Settings >Pending Payment Order Lifetime (minutes)
If you set this to anything less than an hour, the order stays in Pending Payment status until the sales_clean_orders cron is run (once an hour), it doesn't trigger the cron any earlier. If the time is set to more than an hour then this setting works as expected. The default setting of 8 hours works as expected.
Steps to reproduce
Navigate to setting:
Stores > Configuration >Sales > Sales > Orders Cron Settings >Pending Payment Order Lifetime (minutes).
Change to a value less than 60 minutes. E.g 10 minutes.
Expected result
Pending Payment orders are Closed when time value set is reached.
Actual result
Payment Pending orders are not Closed until the sales_clean_orders cron is run every hour.
Additional information
I can tell that the time in the Pending Payment Order Lifetime (minutes) is honoured in some way, for example:
If I set the value to 15 minutes and I place an order at 13:50, when the cron sales_clean_orders is ran at 14:00, the order remains pending (as 15 minutes had not passed - 5 minutes remain). This should, in theory, change to Cancelled status at 14:05. In reality it will not be changed to Cancelled until 15:00 when the next sales_clean_order cron is ran.
If the cronjob time for sales_clean_orders is edited down to run more frequently, for example, every five minutes
<schedule>*/5 * * * *</schedule>
then this runs a bit more accurately as the cron checks for orders to cancel more frequently.In reality, should the minutes set in "Pending Payment Order Lifetime (minutes)." not dictate how often the sales_clean_orders cron is run?
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: