Subscriptions Scheduled Action Errors

WooCommerce Subscriptions uses an applicaiton called Action Scheduler to process scheduled events, like subscription renewals and expiration.

If an error occurs when processing such and event, a notice appears in the WordPress admin dashboard that alert store managers of the error.

This scheduled actions errors guide explains why the notice displays, the likely causes of the issue, steps to diagnose the cause, and how to fix the problem or get help.

Past-due Scheduled Actions

↑ Back to top

Past-due scheduled actions are tasks that missed their scheduled dates. It’s worth noting that due to how WP Cron works, it’s not uncommon to have some past-due actions in your system. If you come across multiple past-due actions that are more than a day old, it could indicate a potential issue with WP Cron. This may result in issues related to missing orders, subscriptions, or data within the WooCommerce Analytics.

Our guide on scheduled events for subscriptions offers a deeper understanding of WP Cron’s role in managing Scheduled Actions, and how to troubleshoot related issues.

Scheduled Action Timeout Notice

↑ Back to top

When a subscription-related action fails due to a timeout, a notice displays in the admin dashboard.

A “timeout” is when an action has been “running” for more than five minutes, at which point Subscriptions considers it failed, and is marks it accordingly. This is because if an action has been running for that length of time, it is likely not running at all.

Scheduled Action Error Notice
Scheduled Action Error Notice

Diagonising and Fixing Affected Subscriptions

↑ Back to top

To fix an affected subscription, follow the steps below.

1. Find Affected Subscriptions

↑ Back to top

The notice that appears after an action timeout contains a note with the subscription number and a link to the edit subscription page for that subscription. Use this to investigate if there are issues with the last renewal payment for the subscription that you need to address manually.

2. Track the Payment Process

↑ Back to top

Next, see if the payment was actually affected. This can be done by tracking when the payment process was affected by looking the subscription’s notes and logs.

Track the Renewal Process

For a renewal order, each stage of the renewal process is documented in the Subscription’s Order notes. To view this process:

  1. Go to the WooCommerce > Subscriptions > Edit Subscription screen.
  2. View the Subscription’s Order notes.
WooCommerce Edit Subscription - Notes
WooCommerce Edit Subscription – Notes

The normal process for a renewal is:

  1. A renewal is due; the subscription moves to an On-hold status.
  2. Subscription creates an order to record the renewal and process payment.
  3. If the subscription renews automatically, the order attempts to process payment and, if successful, the order moves to Complete status.
  4. The subscription movs to Active status.
Subscription notes successful renewal
Subscription Notes – Successful Renewal

Each step above records the date and time at which it was processed. Comparisons can be made between the payment process and the failed action in order to find out when the process timed out.

Failure Before Payment

If the renewal order was created but the payment was not marked complete, the process may have stalled before payment was processed. This can be indicated if the time of failure of the action, as found above, is close to the time of the creation of the renewal order.

To make sure that the payment was not captured, there are a couple steps to take.

  1. Go to the created order, linked to in the Subscription’s notes.
  2. Check the Order notes on the order to see if the status changed and the payment was processed
order notes payment complete
Order Notes – Payment Complete
  1. Log in to the chosen payment gateway’s store account and check if the charge was captured for that order.
  2. If there is no charge, then the process stalled before payment was taken.

Failure After Payment

If payment was captured but the order was not marked Processing or Complete or the subscription was not transitioned to an Active status, then the process stalled after payment. This can be indicated if the time of failure of the action, as found above, occurs after the payment was marked complete.

3. Fix Affected Subscriptions and Orders

↑ Back to top

Payment was not taken

If payment was not captured:

  1. Check if there’s a renewal order (pending or failed) present for the affected subscription. If yes, change its status to Cancelled and Update. (Note: Please ensure you are only canceling the renewal order, not the entire subscription. Canceling a subscription will prevent it from being switched to active later.)
  2. Set the subscription status to Active and Update.
  3. Choose Process renewal from the subscription option dropdown.
  4. This will then create a new renewal order, which should process as normal.

Payment was taken

If payment was captured but the order and subscription were not updated:

  1. If the renewal order was not marked Processing or Complete, change the status to the appropriate status.
  2. This will also update the subscription to Active.
  3. If only the subscription dit not change to active, set the subscription status to Active.

Diagnosing the Cause

↑ Back to top

It’s impossible to programmatically identify the cause of a timeout. Instead, they always require manual investigation, which is why this notice displays. There are a number of possible causes (outlined below), which should be explored to find the cause of the timeout.

Subscriptions Version

↑ Back to top

Timeouts, and thus the error notices, are extremely rare occurrences in recent versions of Subscriptions so the first step after seeing such a notices is to update to the most recent version of WooCommerce Subscriptions if it’s not up-to-date on your store.

If WooCommerce Subscriptions is up to date, you should still check the version of Subscriptions at the time of the error. It’s possible that the error occurred before a recent update.

Follow these steps to check the version of Subscriptions running when the error occurred:

  1. Go to WooCommerce > Status > Logs.
  2. Review the WCS Upgrade log and the Failed Scheduled Actions log.
  3. Compare the error time in the Failed Scheduled Actions log to the WooCommerce Subscriptions version currently running, as found in the WCS Upgrade log.

If you were running a much older version of Subscriptions when the error occurred, and you have since updated Subscriptions, it has likely resolved the underlying issue

Otherwise, you’ll want to investigate other potential causes.

PHP Time Limit

↑ Back to top

The PHP time limit is the amount of time the server will spend on a single process before it timesout. A time limit that is too short can cause processes to timeout, meaning it stops before fully completing. A common default value is 30 seconds, but many managed hosts provide a longer timeout period.

Follow these steps to find the PHP time limit for your site’s server:

  1. Go to WooCommerce > Status to view the system status.
  2. Scroll down to the Server environment section.
  3. View the PHP time limit value.
The site server's PHP time limit as per the site's Status Report
The site server’s PHP time limit as per the site’s Status Report

If this limit is below 30 seconds, we recommend increasing it to avoid scheduled action timeouts.

To change this limit, contact your hosting provider and discuss with them the best way to change the time limit.

Large Number of Timeouts

↑ Back to top

This kind of notice and timeout should be an infrequent occurrence. In sites where there are dozens of timeouts or more, there is likely a critical underlying problem causing the timeouts that needs investigating and a solution.

To check the number of timeouts review the Failed Scheduled Actions log.

If there are many timeouts, please log into your WooCommerce.com accounbt, have your valid WooCommerce Subscriptions license handy, and open a support ticket.

Fatal Errors

↑ Back to top

Fatal errors are errors that causes any code processes to stop running and can contribute to failed scheduled actions. To look for and identify the causes of fatal errors, refer to the Finding PHP Error Logs guide.