If you have made sure callbacks are not blocked by your site and you are still experiencing pending or canceled orders in WooCommerce for successful payments, the issue might be due to WP-Cron not working. WP-Cron is WordPress’s way of handling scheduled tasks.
Scheduled actions and WP-Cron not working
When scheduled actions and WP-Cron are not working, several critical issues can arise, primarily impacting order management and synchronization between your WooCommerce store and the payment service provider (PSP).
Here are a few examples of what can happen with orders when you are having issues with WP-Cron on your site:
1. Stuck orders in Pending payment status
WooCommerce’s default behavior when a customer initiates a payment is that a WooCommerce order is typically created first with the status Pending payment. The customer is then redirected to the payment gateway to finalize the payment. If WP-Cron isn’t running, WooCommerce’s internal woocommerce_cancel_unpaid_orders scheduled action (which relies on WP-Cron) won’t execute. This can cause:
- Abandoned orders remain pending
If a customer abandons the payment process, or if the payment fails (for example insufficient funds or card declined), the corresponding WooCommerce order will remain in Pending payment status indefinitely. - Held stock not released
By default, WooCommerce places products in a “held” state for a set period (configured in WooCommerce → Settings → Products → Inventory) while a payment is pending. If WP-Cron fails, these held stock items for abandoned or failed orders will not be released, leading to inaccurate inventory and potentially preventing other customers from purchasing those items. - No automatic order status updates
The payment provider usually communicates the final payment status back to WooCommerce. However, crucial backend processes for updating the WooCommerce order status (from Pending payment to Processing or Failed) might be triggered by scheduled actions. If these don’t run, orders can get stuck in an incorrect state.
2. Synchronization issues with order management
Most of our plugins have support for order management, which allows merchants to perform actions like capturing, refunding and canceling orders directly from the WooCommerce admin. While many of these actions might be triggered immediately by user interaction, some background synchronization tasks that keep the WooCommerce order status in sync with the PSP system might rely on scheduled actions. If WP-Cron is down, it can cause:
- Delayed captures
Automatic captures of orders, for example when the WooCommerce order status is set to “Completed”, might not happen promptly, delaying the payment processing. - **Out-of-sync statuses
**The order status in WooCommerce might not accurately reflect the true status or data on the order from the PSP, leading to confusion for merchants and potential discrepancies in reporting. - Failed refunds/cancellations
While manual refunds/cancellations initiated from WooCommerce should ideally trigger direct API calls to the payment provider, there could be retry mechanisms or secondary processes that depend on scheduled actions. If these fail, a refund/cancellation initiated in WooCommerce might not be fully processed or reflected in the PSP.
3. Missed or delayed notifications
WooCommerce sends various automated emails to the customer related to order status changes (for example order processing, payment failed, order canceled). Many of these are dispatched via WP-Cron. If WP-Cron isn’t working, customers might not receive order confirmations, payment failure notifications or cancellation emails, leading to a poor customer experience and increased support inquiries.
Merchants might also miss important notifications about order issues or updates.
4. Performance issues (in some cases)
When WP-Cron is not running, scheduled tasks can accumulate. If WP-Cron is enabled but the site has little traffic, a later visit can trigger overdue tasks and increase server load. If DISABLE_WP_CRON is set to true, visits will not trigger WP-Cron. Configure a server-side cron job or re-enable WP-Cron so the overdue tasks can be processed.
General steps on how to diagnose and fix WP-Cron issues
When you have issues with WP-Cron, you need to debug what might be causing them. Here are a few steps to follow:
- Install WP Crontrol, essential for seeing all scheduled events.
https://wordpress.org/plugins/wp-crontrol/ - Check for overdue or missed hooks:
–woocommerce_cancel_unpaid_orders
–action_scheduler_run_queue– the core hook for Action Scheduler, which many plugins, including payment gateways, use. - Check
wp-config.phpforDISABLE_WP_CRON. If it is set to true, make sure a proper server-side cron job is configured. - Check server logs. Look for errors related to
wp-cron.phpor any PHP errors that might be terminating processes prematurely. - Temporarily disable caching. Aggressive caching can prevent
wp-cron.phpfrom executing. - Isolate plugin conflicts. Deactivate other plugins to see if one is interfering with WP-Cron or the payment gateway’s scheduled tasks. Note that WooCommerce is required for our plugins to work.
You can read the WooCommerce documentation on Scheduled actions and WP-Cron here:
https://woocommerce.com/document/understanding-the-woocommerce-system-status-report/scheduled-actions/
WooCommerce also has a complete guide on how to debug WP-Cron here:
https://woocommerce.com/document/subscriptions/develop/complete-guide-to-scheduled-events-with-subscriptions/#debugging-wp-cron