How to Disable WooCommerce Action Scheduler / Subscriptions on a Staging Site

Suppose you use the “WooCommerce Subscriptions” plugin or any other subscription plugin to charge your customers recurring. In that case, you definitely want to stop your customers from being automatically charged again — at worse, multiple times during testing — from your staging site.

You also want to stop executing other scheduled events on your staging site, like sending out expiration license reminder emails. To disable these automatic events, you will need to disable the background action scheduler, which is used by WooCommerce.

You have two options to disable Subscriptions and to disable the WooCommerce action scheduler:

Disable WooCommerce Action Scheduler for Subscriptions by Using a Plugin

Install and activate the free plugin Action Scheduler – Disable Default Runner.

Disable WooCommerce Action Scheduler for Subscriptions by using code

Add the code below into the functions.php or a separate plugin:

PHP
function PREFIX_disable_action_scheduler() {
    if ( class_exists( 'ActionScheduler' ) ) {
        remove_action( 'action_scheduler_run_queue', array( ActionScheduler::runner(), 'run' ));
    }
}
add_action( 'init', 'PREFIX_disable_action_scheduler', 10 );

Note: Change PREFIX to something unique.
This plugin/code disables all events in the WooCommerce action scheduler library that are used by WooCommerce plugins, so scheduled events like recurring payments or sending out emails will be disabled for WooCommerce and all of its add-ons.

For more information, check out this article.

Updated on June 4, 2024

Alaa Salama

Author: Alaa Salama

I have spent more than a decade in the support field because I truly enjoy the human side of technology. Whether I’m solving a complex WordPress issue or developing custom plugins and code snippets to streamline workflows, my goal is always to reduce friction and help people work smarter. For me, there is nothing more rewarding than seeing a solution I’ve built make someone else’s day better.

When I’m offline, I’m usually still "under the hood" of something. I’m passionate about server optimization and DIY electronics, often spending my free time on smart home projects and hardware repairs. I especially value the time spent in my home workshop with my children; together, we tackle everything from household fixes to creative projects, fostering a love for building things that last.