What’s New in Subscriptions 3.0

You are here:

Subscriptions 3.0 includes a major update to the system used to schedule and run events in the future.

This update migrates data, which can not be undone without restoring a backup of the database taken prior to updating.

3.0 is a “major” release and is not backwards compatible with previous versions of WooCommerce Subscriptions. With this in mind, please employ best upgrade practices to ensure a smooth update process. Please refer to the Subscriptions Upgrade Guide for more details.

Key Points

  1. Subscriptions 3.0 includes an update to the Action Scheduler library.
  2. Action Scheduler 3.0 contains a data migration and as such isn’t compatible with previous versions. Once the data migration has started, rolling back will lead to data loss.
  3. Action Scheduler is a library packaged with other extensions as well, including but not limited to WooCommerce core and WooCommerce Memberships. Because of the way this library loads, only 1 instance of it is loaded and that version is the latest one. This means by upgrading to WC Subscriptions 3.0 which contains Action Scheduler 3.0, all other plugins will also start using Action Scheduler 3.0 too.
  4. By upgrading to Action Scheduler 3.0 you can expect to see performance improvements to the processing rate of scheduled payments and other events.
  5. There are no other major features included in this version of Subscriptions.
To learn more about what Action Scheduler is and how it’s used in WooCommerce Subscriptions, take a look at our  Complete Guide to Scheduled Events with Subscriptions.

Upgrade Process

Because this is a major version with data migration, we recommend: 

  1. Taking a backup of your site before updating to Subscriptions 3.0.
  2. Test the update on a staging copy of the live site.

Once you update to Subscriptions 3.0, if your site meets the migration requirements, the data migration will start automatically and will run in the background. While the data migration is happening, you can continue to use your site as normal.

Update Process for Sites Running the Action Scheduler Custom Tables Plugin

If your site has been using the Action Scheduler Custom Tables plugin to boost performance in advance of WooCommerce Subscriptions / Action Scheduler 3.0, you should disable this plugin immediately after updating to WooCommerce Subscriptions 3.0. 

The same code used in that plugin has now been merged with Action Scheduler 3.0, which is included in Subscriptions 3.0.

Migration via WP CLI

After upgrading to Subscriptions 3.0, the action scheduler migration will happen automatically in the background. However, it is possible, if you prefer, to run these upgrades via the CLI.

To migrate the action scheduler data via CLI, use the following command:

wp action-scheduler migrate

Once the migration starts, you will be given periodic updates about the process.

Action Scheduler WPCLI migration output
Action Scheduler WP CLI migration output

This command will continue running until all scheduled actions have been migrated. 

Once the migration is complete you will see the following output:

Success: Migration complete. x actions processed.

Depending on the number of actions which need to be migrated, this may take some time.

The memory cleanup warnings aren’t something to be concerned with. When the memory used to migrate the data approaches the limit, we clear the object caches to free up memory.


Increased Processing Rate for Scheduled Payments

WooCommerce Subscriptions 3.0 will process queues of scheduled payments significantly faster than previous versions. Scheduled payments are processed in a batch that can run for up to 20 seconds. In versions of Subscriptions prior to 3.0, after that time limit was reached, processing would cease until another WP Cron request.

With WooCommerce Subscriptions 3.0, whenever one request approaches the time limit for processing payments, a new request is initiated to start processing the next set of batches. This process repeats until there are no more payments to process, or no loopback requests can be made.

This significantly increases the throughput of payment processing.

For example, consider a site with 1,000 scheduled payments due where it takes 1 second to process each payment and WP Cron is run every minute on this site. With WooCommerce Subscriptions 3.0, these payments will be processed in approximately 17 minutes. With Subscriptions prior to 3.0, it would have taken approximately 50 minutes to process the same number of payments on the site.

Scheduled Payments Now Run on All Admin Requests, not just WP Cron

Prior to WooCommerce Subscriptions 3.0, scheduled recurring payments would be initiated by WP Cron. With WooCommerce Subscriptions 3.0, whenever a store manager visits the administration dashboard, WooCommerce Subscriptions will check if the site has pending scheduled payments and begin to process them.

This helps ensure payments are processed, even if there is a problem with the WP Cron system.

Scheduled Event Data Migrated to Custom Tables from Custom Post Type

WooCommerce Subscriptions 3.0 moves all scheduled job data to custom tables. Previously, this data was stored alongside product, order, subscription, post, and page data in your WordPress database.

Storing data in the same location as these other objects meant that both Action Scheduler database performance was slower, and performance across all other data was slower. With WooCommerce Subscriptions 3.0, the database performance is improved across all areas where post data is queried.

Other Changes

Admin Subscription and Order Status Visual Updates

Subscriptions 3.0 includes an update to the way subscription and order statuses are displayed on subscription-related admin screens. This is to bring them in line with the way WooCommerce displays these statuses.

Subscription Admin table
Admin subscriptions table statuses
Subscription related order admin table
Edit subscription related order statuses
Subscription retry payment admin table statuses
Edit subscription payment retry order and subscription statuses


What are the requirements for using Action Scheduler 3.0?

In order to migrate the action scheduler data to custom tables your site must meet the following requirements:

  1. Be running PHP 5.5 or higher. 
  2. Have no scheduled actions with a combined arguments length greater than 191 characters.

If either of these conditions isn’t met, your site will remain using the WordPress posts data structures and tables to store Action Scheduler data. 

This means you can still upgrade to Subscriptions 3.0 and your site will continue to function as it has, however, the data migration won’t occur and so you won’t see the performance improvements that come with this release.

Should I update now or wait?

As with any major update, we suggest that you:

  1. Take a backup of your site before upgrading.
  2. Test the update on a staging site before updating the live site.
  3. Once everything looks good on the staging site then update the live site. 

For more details about how we recommend updating Subscriptions, take a look at our Subscriptions Upgrade Guide.

Following these steps is the only way to be sure Subscriptions 3.0 is safe to run on your site.

Whether you should update now or wait is something only you as the store owner can answer. To help answer this question you should keep in mind a couple of things:

  1. Have you tested the update on a staging copy of the live site?
  2. How vigorously have you tested the normal functions of your site while it is running 3.0? You can do this on your staging site first.
  3. What is the current or upcoming site traffic likely to be? Do you have an upcoming sale for example? Do you have thousands of renewals all scheduled to run in a couple of days? If so, it might be better to wait until after that period before upgrading.
  4. How confident are you that if things did go wrong, you would be able to roll back the database and plugin to a previously saved version.

None of my renewals have processing on time. What’s happening?

The first thing to check is if you have upgraded to Subscriptions 3.0. To check which version of Subscriptions you have active:

  1. Go to the Plugins from your WordPress admin dashboard.
  2. Find WooCommerce Subscriptions
  3. Under the plugin description is the version number.

If you do have WooCommerce Subscriptions 3.0 or above active, we’ll need to investigate why the scheduled actions are missing or aren’t running on time. To get in contact with us, please open a ticket.

All my scheduled actions haven’t migrated yet, will my site still run as normal?

Yes, while the data migration is in progress, Subscriptions will continue to process scheduled actions in both the post tables and custom tables. 

How long will the migration take?

How long it will take to migrate all your scheduled action data will depend on your store’s specific circumstances: 

  1. How many actions need to be migrated.
  2. How many actions your site can migrate at a time. This will depend on your server environment.

If you’re familiar with WP CLI you can run the data migration via a WP CLI command. This is the quickest way to complete the migration.

See our section on migrating the action scheduler data via WP CLI.

What performance improvements can I expect to see from this update?

The performance improvements you will see will be unique to your site and is dependent on the number of scheduled actions your site typically has to process in short periods of time. 

For example, if you have 10-20 renewals occur on one given day over the space of a number of hours, you will likely see some negligible performance improvements. These improvements will come in the form of quicker database queries for orders, subscriptions and other data stored in the posts tables.

If however you have all your subscriptions synced to run on 1 day (for example the 1st of each month) and you have 1000+ renewals. You will see much larger improvements in the time it takes to process those payments and the general improvements to post queries on your site.

Where almost all users will see an improvement is in data migration and generation in plugins that use scheduled actions to run these events in the background. For example, WooCommerce Subscriptions, in past plugin updates, has used scheduled actions to fix corrupted data or generate new data for existing customers orders and subscriptions. This process usually loops over every item (order, subscription, or customer) and processes it individually. Because these data repair or migration scripts use Action Scheduler to run a lot of events over a short period of time, the speed at which they complete for sites of all sizes will be improved by this update.

In some internal tests comparing Action Scheduler 3.0 with 2.5.5 we saw a:

  • ~69% reduction in the amount of database storage required. 
  • ~68% reduction to the time it takes to create and store scheduled actions. 
  •  60-72% reduction in the time it took to receive 50 scheduled action results used populate the admin table sorted by field. 

These were the results on a site populating WooCommerce Admin data with: 

  • 7500 customers
  • 5000 products
  • 50,000 orders

My site just updated to WC Subscriptions 3.0. Can I roll back to 2.x.x?

No. Because Subscriptions 3.0 includes data migration, rolling back to an earlier version will result in lost data.

Earlier versions of Subscriptions cannot interact with the migrated data, only 3.0 and above can.

If your site is not responding or not functional after upgrading to Subscriptions 3.0 you can attempt to roll back the database and plugins if it’s safe to do so, otherwise please contact support so we can investigate further.

I use WooCommerce Memberships which also uses Action Scheduler. Will Memberships still work after this upgrade?

Yes, WooCommerce Memberships will continue to work as normal after upgrading to Subscriptions 3.0. Memberships interacts with the Action Scheduler library in a way that won’t be affected by this upgrade. In fact, Membership related scheduled action events will also benefit from the performance improvements included in this release.

I use a plugin which uses Action Scheduler. Will this plugin still work after this upgrade?

Most likely yes, however it depends on how the plugin is interacting with Action Scheduler data. If the plugin is using Action Scheduler APIs they will continue to work as normal. If, however, the plugin is interacting with the database directly or using some of the schedule types which previously didn’t work as described, they may run into issues.

If you are unsure, please reach out to the developer of the plugin using Action Scheduler to ask whether their plugin is compatible with Action Scheduler 3.0.

Was this article helpful?
Dislike 0
Views: 25