MKashif Razzaq
MKashif Razzaq

Reputation: 3

PHP Fatal error: Uncaught Error: Call to undefined function as_next_scheduled_action()

When I tried to update Woocommerce plugin into new version (3.6.1) I got this error

[21-Apr-2019 20:29:10 UTC] PHP Fatal error: Uncaught Error: Call to
undefined function as_next_scheduled_action() in
/home/tleelxvn/fairo.pk/wp-
content/plugins/woocommerce/includes/queue/class-wc-action-queue.php:127
Stack trace:
#0 /home/tleelxvn/fairo.pk/wp-content/plugins/woocommerce/includes/admin/marketplace-suggestions/class-wc-marketplace-updater.php(30):
WC_Action_Queue->get_next('woocommerce_upd...')
#1 /home/tleelxvn/fairo.pk/wp-includes/class-wp-hook.php(286): WC_Marketplace_Updater::init('')
#2 /home/tleelxvn/fairo.pk/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#3 /home/tleelxvn/fairo.pk/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
#4 /home/tleelxvn/fairo.pk/wp-settings.php(505): do_action('init')
#5 /home/tleelxvn/fairo.pk/wp-config.php(79): require_once('/home/tleelxvn/...')
#6 /home/tleelxvn/fairo.pk/wp-load.php(37): require_once('/home/tleelxvn/...')
#7 /home/tleelxvn/fairo.pk/wp-cron.php(39): require_once('/home/tleelxvn/...')
#8 {main}
thrown in /home/tleelxvn/fairo.pk/wp-content/plugins/woocommerce/includes/queue/class-wc-action-queue.php
on line 127

Upvotes: 0

Views: 2625

Answers (1)

Trevor Mills
Trevor Mills

Reputation: 424

I came up against this exact problem today. My situation may be unique, but if what I learned helps anyone, all the better.

In my situation, I have code within my theme where I'll force load WooCommerce if it isn't loaded. The site requires WooCommerce on an AJAX call that otherwise knows nothing about WordPress. In normal WordPress requests, the plugin is already loaded, so my code block does nothing.

However, I received this error when I stood up a new site with the same repo and I had not yet activated the WooCommerce plugin. As soon as I activated it, the error disappeared. The reason the error occurred is because the required file only gets included on the plugins_loaded action, which in my scenario had already been run by the time I force-loaded WooCommerce.

Upvotes: 1

Related Questions