- This topic has 13 replies, 3 voices, and was last updated 1 year, 2 months ago by Tom.
-
AuthorPosts
-
December 2, 2021 at 12:29 pm #2036308Bret
All latest WP, GP, and GP Premium bits:
`
[02-Dec-2021 19:24:57 UTC] PHP Fatal error: Uncaught Error: Call to undefined function is_checkout() in /var/www/demo/production/wp-content/plugins/gp-premium/woocommerce/functions/functions.php:450
Stack trace:
#0 /var/www/demo/production/wp-includes/class-wp-hook.php(303): generatepress_wc_checkout_sidebar_layout(‘no-sidebar’)
#1 /var/www/demo/production/wp-includes/plugin.php(189): WP_Hook->apply_filters(‘no-sidebar’, Array)
#2 /var/www/demo/production/wp-content/themes/generatepress/inc/theme-functions.php(62): apply_filters(‘generate_sideba…’, ‘no-sidebar’)
#3 /var/www/demo/production/wp-content/themes/generatepress/inc/general.php(177): generate_get_layout()
#4 /var/www/demo/production/wp-includes/class-wp-hook.php(303): generate_smart_content_width(Object(WP))
#5 /var/www/demo/production/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
#6 /var/www/demo/production/wp-includes/plugin.php(518): WP_Hook->do_action(Array)
#7 /var/www/demo/production/wp-includes/class-wp.php(763): do_action_ref_array(‘wp’, Array)
#8 /var/www/d in /var/www/demo/production/wp-content/plugins/gp-premium/woocommerce/functions/functions.php on line 450
`
Just clicked an activation link for a new user, and got this error……
December 2, 2021 at 12:29 pm #2036310Bretcheck the activation link below
December 2, 2021 at 3:34 pm #2036459TomLead DeveloperLead DeveloperHi there,
None of the WooCommerce module functions should be firing unless WooCommerce is installed and activated.
Can you confirm that this site has WooCommerce activated already?
December 2, 2021 at 3:35 pm #2036462BretYup, it’s activated…..
it is a multisite instance, but yeah its a shop demo site so its definitely activated.
December 2, 2021 at 3:49 pm #2036471TomLead DeveloperLead DeveloperHmm, so
is_checkout()
should be defined.Is WooCommerce network activated? What about GP Premium?
This could explain it: https://core.trac.wordpress.org/ticket/23197
December 2, 2021 at 4:12 pm #2036480BretThis could explain it.
Currently neither GP Premium or WooCommerce are network activated but I might have changed the GP Premium config as I flailed about awkwardly trying to fix the problem.
What is the recommended configuration then? Sorry that’s not clear…..
December 2, 2021 at 6:12 pm #2036543TomLead DeveloperLead DeveloperI’m more curious than anything at this point – multisite can be very weird.
What happens if you network activate WooCommerce? Does the error go away when activating GPP?
December 6, 2021 at 10:11 am #2040285BretOK will try a few variations and see if it makes any difference
December 2, 2022 at 3:03 am #2446414PierreHello,
I have the same problem here. On a site in production, it’s quite annoying.
@Tom is it possible to add aif( function_exists( 'is_checkout' ) )
in /gp-premium/woocommerce/functions/functions.php:450 ?
Thanks
December 2, 2022 at 8:49 pm #2447486TomLead DeveloperLead DeveloperWe can absolutely do that, but that would mean adding checks like that to a lot of different areas in our WooCommerce integration.
Technically, none of that code should fire at all if WooCommerce isn’t activated. Are you using multi-site as well? Is the error happening on a site that has WooCommerce activated?
December 2, 2022 at 10:53 pm #2447534PierreHi Tom,
It’s a multisite with subdomains installations.
Site 1 : main.domain.com, GP premium activate, Woocommerce deactivate.
Site 2 : other.domain.com, GP premium activate, Woocommerce deactivate.
Site 3 : shop.domain.com, GP premium activate with Woocommerce module, Woocommerce activate.
The user has created an account on the shop.
The activation link seems correct, like :
https://shop.domain.com/wp-activate.php?key=7uj7607e88bf7c88
But arrives on a fatal PHP error.Strange bug. Later I will do more tests.
December 3, 2022 at 8:56 pm #2448596TomLead DeveloperLead DeveloperVery strange, indeed.
We’ll make a note to add this check to GPP 2.3.0.
Can you confirm that adding the check in that one place fixes the issue if you change your file to include it?
December 7, 2022 at 4:38 am #2452865PierreHi Tom,
Here are the changes I had to make to avoid a PHP fatal error:
function generatepress_wc_checkout_sidebar_layout( $layout ) { if( ! function_exists( 'is_checkout' ) ) { return $layout; }
function generatepress_wc_show_sticky_add_to_cart() { if( ! function_exists( 'wc_get_product' ) ) { return; }
function generatepress_wc_scripts() { if( ! function_exists( 'is_checkout' ) ) { return; }
function generatepress_wc_checkout_footer_widgets( $widgets ) { if( ! function_exists( 'is_checkout' ) ) { return $widgets; }
I think it’s a bug in the WordPress core. I created a plugin that registers a “random_test()” function, and is only activated on the shop site. In another plugin, I have an filter on the WordPress hook “body_class”. In the function called by this filter, I call random_test(). This also causes a PHP fatal error on wp-activate.php. So wp-activate.php does not load the plugins correctly.
January 26, 2023 at 8:32 pm #2510583TomLead DeveloperLead DeveloperThanks for that! This has been implemented in GPP 2.3.0.
-
AuthorPosts
- You must be logged in to reply to this topic.