Blog

WooCommerce scheduled actions not running: how to fix it

Ink sketch of a wall clock above a small server rack with one green status light.

WooCommerce scheduled actions stop running when nothing starts the queue. WooCommerce keeps its timed jobs, such as starting a sale, ending a sale and cancelling unpaid orders, in a queue called Action Scheduler. By default that queue is started by WP-Cron, and WP-Cron only runs when someone loads a page. On a quiet store, or one where WP-Cron has been turned off with no replacement, actions sit at Pending past their time. The fix is a real cron job on your hosting that calls wp-cron.php every few minutes, plus a site that can reach its own address.

This guide shows how the queue works, what a test store did with and without visits, how to spot stuck actions, and how to set up the cron job.

What are WooCommerce scheduled actions?

They are jobs WooCommerce has queued to run at a set time. You can see them under WooCommerce, Status, Scheduled Actions. The list has tabs for Pending, Complete, Failed, Canceled and Past-due, and each row shows the job’s hook name, when it was due, and a log.

We read WooCommerce’s source, version 11.3.0, which bundles Action Scheduler 4.1.0. Some of the jobs it queues:

  • wc_product_start_scheduled_sale and wc_product_end_scheduled_sale. One of each per product with sale dates, due at the exact start and end time.
  • woocommerce_scheduled_sales. A daily job at midnight in the store’s time zone. The source calls it a safety net that catches any sale the per-product jobs missed.
  • woocommerce_cancel_unpaid_orders. Due after the “Hold stock (minutes)” setting, which defaults to 60 minutes. In the source, WooCommerce only cancels unpaid orders this way when stock management is turned on.
  • Cleanup jobs for old sessions, logs and personal data.

Other plugins add their own jobs to the same queue. Action Scheduler’s own site says it runs subscription payments, WooCommerce webhooks, and emails and other events for many plugins. When the queue stalls, all of them stall together.

How does WP-Cron decide when to run?

We read WP-Cron in the WordPress 7.1.4 source. On every page load, at the very end of the request, WordPress checks whether any scheduled job is due. If one is, it sends a request to its own wp-cron.php file and does not wait for the answer. That second request runs the due jobs. A lock stops a new run from starting within 60 seconds of the last one.

Three things follow from that code:

  • No page loads, no jobs. A job due at 2 am runs at the first page load after 2 am, whenever that is.
  • The site must be able to reach itself. If the request to its own wp-cron.php fails, the jobs never run, even on a busy site.
  • DISABLE_WP_CRON turns it off. With define( 'DISABLE_WP_CRON', true ); in wp-config.php, page loads no longer start WP-Cron at all. Something else has to call wp-cron.php.

Action Scheduler sits on top. Its FAQ says it is started by WP-Cron and by page loads in wp-admin. In its source, the WP-Cron part is a job called action_scheduler_run_queue, set to run every minute.

What did a test store show?

We set up a throwaway store with WordPress 7.1.4, WooCommerce 11.3.0 and PHP 8.3. We made a product priced 1,000 with a sale price of 800, set to start a few minutes later. Then we read the queue and the product’s stored price straight from the database, so that our checks did not load any pages.

Test 1. Default settings, no visitors

Two and a half minutes after the sale’s start time, with no page loads in between, the start job was still Pending and the stored price was still 1,000. Then we loaded the product page once. The server log showed the site sending a request to its own wp-cron.php in the same second. The job changed to Complete and the stored price changed to 800.

So with default settings, the sale started when the first visitor arrived, not at the time we set.

Test 2. WP-Cron turned off, no cron job

We set DISABLE_WP_CRON to true and made a second sale product. After its start time we loaded the product page three times. The job stayed Pending, the stored price stayed 1,000, and the server log showed no request to wp-cron.php.

Then we made one request to wp-cron.php ourselves, which is exactly what a server cron job does. The job completed within that request and the stored price changed to 800.

Test 3. WP-Cron turned off, owner opens wp-admin

With WP-Cron still off, we made a third sale product. After its start time we logged in and opened the dashboard. Three seconds later the site made a background request to admin-ajax.php with the action “as_async_request_queue_runner”, and the job completed.

This explains a common complaint. The store owner logs in to check why a sale did not start, and by the time they look, it has started. Their own visit to wp-admin ran the queue.

Why does a sale look right but still count as “not working”?

In test 2, the product page showed the sale price of 800 even while the stored price was 1,000. WooCommerce added a fix for this in version 11.1, a class called ScheduledSalePriceReconciler. When a sale has started or ended but the stored price has not been updated yet, it corrects the price at the moment a page reads it.

The comments in that class say what it does not cover. For a variable product, the “From” price, the sale badge and the lowest and highest prices can stay out of date until the job runs or someone saves the product. So a simple product can look right while a variable product next to it shows the old price. Anything that reads the stored price directly also sees the old value until the job runs.

On older WooCommerce versions there is no such correction, so a late job means the old price shows everywhere.

How do you check whether scheduled actions are stuck?

  1. Look at the Past-due tab. Go to WooCommerce, Status, Scheduled Actions. Past-due shows jobs whose time has passed but have not run. The Action Scheduler FAQ says a few past-due actions are normal because of how WP-Cron works, but several more than a day old mean something is wrong.
  2. Look for the warning. In the source, Action Scheduler shows “Action Scheduler: N past-due actions found; something may be wrong.” in wp-admin when jobs are more than a day late.
  3. Open Site Health. Go to Tools, Site Health. WordPress runs two checks that matter here. One reports “A scheduled event is late” or “A scheduled event has failed”. The other reports “Your site could not complete a loopback request” when the site cannot reach its own address.
  4. Read the Failed tab. A job that ran and hit an error goes to Failed. Its log shows the error message, which usually names the plugin at fault.

How do you fix scheduled actions that are not running?

Set up a real cron job

A real cron job calls wp-cron.php on a timer, whether or not anyone visits. WordPress.org’s handbook page on hooking WP-Cron into the system task scheduler gives the command. On cPanel hosting, use the Cron Jobs screen, described in cPanel’s documentation:

  1. In cPanel, open Cron Jobs.
  2. Under Add New Cron Job, set the timing. For every five minutes, enter */5 in Minute and * in the other four boxes.
  3. In Command, enter the line below with your own domain.
  4. Click Add New Cron Job.
wget --delete-after https://example.com/wp-cron.php >/dev/null 2>&1

The handbook explains that --delete-after stops wget from saving a copy of the page every time. cPanel’s documentation says that adding /dev/null 2>&1 to the end of a command turns off the email cPanel would otherwise send each time the job runs.

Once the cron job is in place, add this line to wp-config.php, above “That’s all, stop editing!”:

define( 'DISABLE_WP_CRON', true );

Add the cron job first and the line second. The other way round, nothing runs your jobs in between, which is test 2 above.

How often should the cron job run?

Action Scheduler’s own WP-Cron schedule is every minute, and a scheduled sale can only start as close to its time as your cron job allows. Every five minutes keeps a store’s jobs within about five minutes of their time. If your host allows every minute and your store relies on exact times, use that. A daily cron job, like the handbook’s midnight example, is too slow for a store.

Fix a failing loopback

If Site Health says the loopback request failed, the site cannot call itself, and WP-Cron fails even with plenty of visitors. Our test server had this problem at first. Requests from the site to its own address got no answer, and none of its WP-Cron requests reached wp-cron.php until we fixed the server setup. A real cron job works around a failing loopback because the request comes from outside. You should still ask your host to fix the loopback. Site Health’s own description says WordPress’s built-in theme and plugin editors use it too.

Run stuck jobs by hand

On the Scheduled Actions screen, hover over a pending job and click Run. Action Scheduler describes it as “Process the action now as if it were run as part of a queue”. If you have SSH and WP-CLI, wp action-scheduler run works through the whole queue. Neither replaces the cron job. They only clear what has piled up.

Does a busy store still need a cron job?

Usually yes. WP-Cron runs inside WordPress’s own page load. If a page cache serves a visit without starting WordPress, that visit does not start WP-Cron either. Our post on why WordPress is slow explains page caching, and it is the right choice for speed. It just means visitor traffic is not a reliable timer for your jobs.

A cron job also moves the work off your visitors’ page loads. With WP-Cron, a visitor’s request is the one that sets off the jobs. With a cron job, the server does it on its own schedule.

cPanel has a Cron Jobs screen for this, and our post on WordPress hosting vs shared hosting covers what else to look for in a hosting control panel. For a store, our WooCommerce hosting page explains what the plans include.

Frequently asked questions

Why are my WooCommerce scheduled actions stuck on pending?

Nothing has started the Action Scheduler queue since they were due. By default, that needs a page load. Set up a real cron job that calls wp-cron.php every few minutes, and check that Site Health’s loopback test passes.

Is it safe to set DISABLE_WP_CRON to true?

Yes, once a real cron job calls wp-cron.php. Without one, nothing starts WP-Cron from page loads, and scheduled jobs only run when someone opens wp-admin.

Why did my WooCommerce scheduled sale not start on time?

The job that starts it runs only when the queue runs. In our test, with no visitors, the sale started at the first page load after its start time. A cron job every few minutes keeps it close to the time you set.

Can I delete past-due or failed scheduled actions?

You can, but deleting does not fix the cause, and some jobs, such as a sale start, then never run. Fix what stops the queue first, then run the past-due jobs. Read a failed job’s log before deleting it.

Do I need a plugin to run WooCommerce cron jobs?

No. A cron job in your hosting control panel and one line in wp-config.php are enough. Action Scheduler is already part of WooCommerce.

Category:

Written by

Muhammad Dilawar

Muhammad Dilawar

Muhammad Dilawar is a WordPress developer and technical SEO specialist with over 12 years of experience building, optimizing and maintaining websites. He works with WordPress, WooCommerce, server optimization, DNS, SSL, Cloudflare, website security and performance, and is a Top Rated freelancer on Upwork with a 100% recommendation rate.

Hosting for your WordPress site

Yearly plans in rupees, with the same price at renewal. Free SSL and daily backups on every plan.