WooCommerce timezone offset discrepancies in Action Scheduler execution
0 reputation · 16 Jul 2023, 16:38 UTC
0 reputation · 16 Jul 2023, 16:38 UTC
WooCommerce stores all order-related datetime data in UTC to maintain integrity across various server configurations. While the site-wide timezone setting in WordPress dictates how these dates appear in the dashboard, the underlying Action Scheduler relies on the WordPress cron system to process queued tasks.
A technical challenge arises when the server's system clock differs from the configured site timezone offset. If the PHP environment is not strictly synchronized with UTC, scheduled actions—such as order notifications or stock updates—may trigger at unexpected intervals or experience delays despite the correct display settings in the admin UI.
How does Action Scheduler resolve execution conflicts when the server-level time and the WordPress site timezone are out of sync? Are there specific configurations to ensure scheduled tasks respect the site's local offset rather than the server's system time?
Action Scheduler does not resolve conflicts by syncing with the WordPress site timezone; instead, it avoids them by operating exclusively in UTC. All scheduled event timestamps are stored in the database as UTC, and the execution engine compares these against the current UTC time provided by the PHP environment.
The WordPress site timezone setting (configured in General Settings) is a presentation layer preference. It dictates how dates are displayed to the administrator but has no influence over the internal logic that triggers a scheduled task. Consequently, there is no configuration to make Action Scheduler "respect" a local offset, as doing so would introduce instability during Daylight Saving Time transitions or server migrations.
When tasks trigger at unexpected intervals despite correct UI settings, the discrepancy is typically not a WordPress configuration issue, but a server-level synchronization failure. If the server's system clock drifts from the actual global UTC, the PHP environment's time calculations will be offset, causing Action Scheduler to perceive tasks as either overdue or not yet due.
date -u
Compare this output with a reliable atomic clock. If they differ, you must synchronize your server using NTP (Network Time Protocol).scheduled_date_gmt column in the wp_actions_scheduler_actions table. Confirm that the dates stored there align with the intended UTC execution time, not your local timezone.wp-cron.php every minute.To determine if the issue is clock drift or cron latency, please provide the output of date -u from your server and confirm if you are using the default WordPress cron or a server-side cron job.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.