Quote from parhelion on September 16, 2026, 00:45
Hi team,
We are encountering a fatal error during automated cron executions. (specifically when background tasks like Jetpack Sync run wc_get_order()).
Fatal error: Uncaught Error: Call to undefined function wc_get_page_screen_id() in wp-content/plugins/woocommerce-currency-switcher/classes/woocs_hpos.php:55
Stack trace:
#0 wp-content/plugins/woocommerce-currency-switcher/index.php(582): WoocsHpos->getOrderScreenId()
#1 wp-content/plugins/woocommerce-currency-switcher/index.php(384): woocs_is_admin_order_edit_context()
#2 wp-includes/class-wp-hook.php(355): {closure}()
#3 wp-includes/plugin.php(206): WP_Hook->apply_filters()
#4 wp-includes/option.php(256): apply_filters()
...
#17 wp-includes/wc-order-functions.php(94): WC_Order_Factory::get_order()
#24 wp-includes/class-wp-hook.php(353): Automattic\Jetpack\Sync\Actions::do_cron_sync()
#27 wp-cron.php(191): do_action_ref_array()
Cause
The function wc_get_page_screen_id() is loaded exclusively inside the admin context (woocommerce/includes/admin/wc-admin-functions.php).
When background workers, WP-CLI, or WP-Cron load orders via wc_get_order(), option filters trigger woocs_is_admin_order_edit_context(), which invokes WoocsHpos::getOrderScreenId(). Since the admin functions file is not loaded in non-admin/cron contexts, it results in an unhandled E_ERROR.
Suggested Fix
In classes/woocs_hpos.php, you can check if the function exists or directly use \Automattic\WooCommerce\Utilities\OrderUtil::get_order_admin_screen():
public function getOrderScreenId(): string {
if ( ! class_exists( '\Automattic\WooCommerce\Utilities\OrderUtil' ) ) {
return 'shop_order';
}
if ( \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() ) {
if ( function_exists( 'wc_get_page_screen_id' ) ) {
return wc_get_page_screen_id( 'shop-order' );
}
return \Automattic\WooCommerce\Utilities\OrderUtil::get_order_admin_screen();
}
return 'shop_order';
}
Could you please patch this in the next release to prevent background cron processes from failing?
Thanks!
Hi team,
We are encountering a fatal error during automated cron executions. (specifically when background tasks like Jetpack Sync run wc_get_order()).
Fatal error: Uncaught Error: Call to undefined function wc_get_page_screen_id() in wp-content/plugins/woocommerce-currency-switcher/classes/woocs_hpos.php:55
Stack trace:
#0 wp-content/plugins/woocommerce-currency-switcher/index.php(582): WoocsHpos->getOrderScreenId()
#1 wp-content/plugins/woocommerce-currency-switcher/index.php(384): woocs_is_admin_order_edit_context()
#2 wp-includes/class-wp-hook.php(355): {closure}()
#3 wp-includes/plugin.php(206): WP_Hook->apply_filters()
#4 wp-includes/option.php(256): apply_filters()
...
#17 wp-includes/wc-order-functions.php(94): WC_Order_Factory::get_order()
#24 wp-includes/class-wp-hook.php(353): Automattic\Jetpack\Sync\Actions::do_cron_sync()
#27 wp-cron.php(191): do_action_ref_array()
Cause
The function wc_get_page_screen_id() is loaded exclusively inside the admin context (woocommerce/includes/admin/wc-admin-functions.php).
When background workers, WP-CLI, or WP-Cron load orders via wc_get_order(), option filters trigger woocs_is_admin_order_edit_context(), which invokes WoocsHpos::getOrderScreenId(). Since the admin functions file is not loaded in non-admin/cron contexts, it results in an unhandled E_ERROR.
Suggested Fix
In classes/woocs_hpos.php, you can check if the function exists or directly use \Automattic\WooCommerce\Utilities\OrderUtil::get_order_admin_screen():
public function getOrderScreenId(): string {
if ( ! class_exists( '\Automattic\WooCommerce\Utilities\OrderUtil' ) ) {
return 'shop_order';
}
if ( \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() ) {
if ( function_exists( 'wc_get_page_screen_id' ) ) {
return wc_get_page_screen_id( 'shop-order' );
}
return \Automattic\WooCommerce\Utilities\OrderUtil::get_order_admin_screen();
}
return 'shop_order';
}
Could you please patch this in the next release to prevent background cron processes from failing?
Thanks!