Addons: Cron Jobs & Dedicated Queue Runner
Cron jobs on WooCart are executed with two methods:
- Real cron job runner which requests cron job execution every minute. These cron jobs can run up to 180s and you can see them being run in traffic logs (/wp-cron.php?livenessProbe).
- Dedicated cron job runner which runs every 30min with no execution limit (see it WP-CLI by running
wp cron event run --due-now).
You can inspect a list of cron jobs and their last execution by using WP-CLI with
wp cron event list or run all jobs manually
wp cron event run --all.
To manage cron jobs use the plugin WP Crontrol.
Addon: Dedicated Queue Runner
In the case of a large number of cron jobs or scheduled actions (1000+), a dedicated queue runner improves performance by offloading the actions from the web server.
You can check the number of your scheduled actions in WooCommerce > Status > Scheduled Actions.
The addon has an additional monthly cost. It can be enabled or disabled at any time. The configuration is automatic and the store goes offline for a restart.
Adding a custom Cron job
If you need to add a custom cron job that runs, for example, a script, you can do that using WP Crontrol plugin.
- Install and activate the WP Crontrol plugin.
- Go to the Settings > Cron Events and click on Add Cron Event.
- Now enter the following details:
Hook should be
Arguments should be
["https://domain/file.php"]where you replace https://domain/file.php with the URL you need to call.
- Then click Add Event.
Troubleshooting Cron Errors: Allowed memory exhausted
To troubleshoot the issue, you need to install the WP Crontrol plugin. Follow the steps below to find the job exhausting the memory.
- Note the time the error happened from the Errors page. If it's a regular error, find the time interval.
- Open WP Crontrol by going to Tools > Cron Events.
- Open Cron Scheduled in the top menu and find the jobs that are running at the same interval as found in step 1.
- Go back to Cron Events and find the jobs from step 3.
- Run jobs one-by-one, leaving at least 5 minutes between runs. Monitor the Errors log in the WooCart dashboard. One of the jobs will show up in the log. Analyze that job, it usually comes from a plugin. You can then either disable that plugin or troubleshoot the issue further with a developer.