Have you noticed that automatic or scheduled events on your WooCommerce store may have stopped working? Issues like stock levels not updating, order statuses remaining unchanged, or scheduled sales and coupons failing to execute can disrupt your store’s operations. If you’re using plugins from SkyVerge, these issues can sometimes stem from conflicts or cron job failures. Fortunately, there are ways to diagnose and resolve the problem.

What are scheduled events?

Scheduled events in WordPress and WooCommerce can fail for a bunch of reasons. Sometimes, it’s because the WP-Cron system isn’t triggered, which happens if your site doesn’t get regular visitors (since WP-Cron relies on page visits to run). Other times, server issues like timeouts, low resources, or misconfigurations can mess things up. Plugins or themes with bad code can also clash and stop events from running.

What is WP-Cron?

WP-Cron is like WordPress’s built-in scheduler. It’s what handles stuff like publishing scheduled posts, running backups, or checking for plugin updates. But here’s the catch: it’s not like a real server cron job that runs on a strict timer. WP-Cron only kicks in when someone visits your site. So, if your site doesn’t get a lot of traffic, scheduled tasks might get delayed or not run at all. It’s simple, but it’s not perfect for super busy or super quiet sites.

Using WP Crontrol

To see if events are failing on your WooCommerce or WordPress site, you can install WP Crontrol and navigate to Tools > Cron Events. You may notice something like this below. Some missed events are normal if your hosting relies solely on WP-Cron. You should not see events that are days or weeks late.

Accessing your site through command line tools

First things first, to tackle this issue, you’ll need to get into your WordPress site using a command line tool to use some basic WP-CLI commands.

For sites hosted on cPanel hosting, SSH (command line) access might need to be enabled first. You’d log in to cPanel, look for “SSH Access,” and set it up. Then, you’d use an SSH client (command line tool) like Terminal (Mac/Linux) or PuTTY (on Windows) to connect to your website files using the credentials provided by your hosting provider.

If your site is not on cPanel, things might work differently, but you’d still need the following credentials (host, username, and password). If you’re not sure where the site’s files are, don’t have the right permissions, or need the proper credentials, check with your hosting provider for guidance. Once you’re in, you can navigate to the site’s directory and start using WP-CLI commands.

For cPanel, the path is generally /public_html whereas other platforms may use /html, /www, /app, or /public for the WordPress site directory.

Run the ls command to check if you’re in the correct directory. The output should look like this:

Using WP-CLI

The first thing we need to do is to make sure WP-Cron is running on your site. To do this, we’ll run the following command in your WordPress directory: wp cron test

You should see the following message if WP-Cron is working correctly. Anything else may suggest an issue which should be discussed with your hosting provider.

What to do next

Sometimes, the failed events might happen because WP-Cron times out. When WordPress is running a WP-Cron event, it pauses other events to make sure the same task doesn’t accidentally run twice. This pause, or ‘lock,’ lasts up to 60 seconds by default, which is controlled by the WP_CRON_LOCK_TIMEOUT setting.

You can increase this timeout by adding the following code to your wp-config.php file:

define('WP_CRON_LOCK_TIMEOUT', 120);

If you see that WP-Cron is running, as shown in the example above and increasing WP_CRON_LOCK_TIMEOUT does not help, then the most common culprit to the scheduling issue is a plugin/theme conflict. To figure out if that is the case, you’ll want to perform a conflict test to see if you can figure out what plugin (or if it’s your theme) is causing the events to not execute at all.

Important Note: If you can’t have your site down, then I recommend using a staging/test site service like Blog Vault. If you have one of the mid to higher tiers of GoDaddy’s WordPress Hosting plans, then you can use their one-click sync to staging to test your plugins without interfering with your live site.

In the meantime, you’ll need to clear the stuck events from your site so you can run those tests. To do this, you can run the following command in your command line tool.

wp cron event run --due-now

You should see something like this appear in the command line tool.

Please know that if you have a lot of stuck or failed WP-Cron events in Tools > Cron Events, then this list will be much longer.

If you get a critical error or fatal error message when you run the command, you will need to enabled WordPress debugging in the wp-config.php file and then run the command again. This is usually a clear indication that a plugin crashed WP-Cron for the site. You should be able to review the debug log file in /wp-content/debug.log. Please be sure to set WP_DEBUG to false when done.

If you go back to Tools > Cron Events, you’ll see that all events will now be set as Now shown here:

This will resolve the immediate issue or could resolve the issue completely. If you have a lot of plugins or scheduled events, then it may be necessary for you to review and optimize your site.

Published by David Snow

Leave a Reply

Your email address will not be published. Required fields are marked *