Open ajgw opened 4 years ago
Hi @ajgw - thanks for logging this. Can you confirm if these sites are running any other plugins or child themes? Perhaps there's an interaction with another plugin causing this.
Hi @haszari - both sites run Storefront without childtheme. At that state it was Storefront 2.5.5.
Both sites do have plugins but the active plugins do overlap in case of WooCommerce one time: both uses Germanized für WooCommerce. But all sites with WooCommece I manage do have that plugin activated but only this two have Error in logfile.
This is the list of activated plugins:
Aktive Plugins (15) on Site A BackWPup von Inpsyde GmbH – 3.7.1 Borlabs Cookie - Cookie Opt-in von Benjamin A. Bornschein, Borlabs – 2.1.15 Code Snippets von Code Snippets Pro – 2.14.0 Jetpack von WordPress.com von Automattic – 8.5 Meow Lightbox von Jordy Meow, Thomas KIM – 2.0.5 Storefront Footer Bar von WooThemes – 1.0.4 Vendidero Helper von Vendidero – 1.3.0 WooCommerce Composite Products von SomewhereWarm – 7.0.0 Germanized für WooCommerce Pro von vendidero – 2.0.17 Germanized für WooCommerce von vendidero – 3.1.6 WooCommerce Product Add-ons von WooCommerce – 3.0.33 WooCommerce URL Coupons von SkyVerge – 2.9.3 WooCommerce Variation Swatches and Photos von Lucas Stark – 3.1.1 WooCommerce von Automattic – 4.1.0 Yoast SEO von Team Yoast – 14.1
Aktive Plugins (9) on Site B Koko Analytics von ibericode – 1.0.12 Antispam Bee von pluginkollektiv – 2.9.2 BackWPup von Inpsyde GmbH – 3.7.1 Code Snippets von Code Snippets Pro – 2.14.0 Gutenberg von Gutenberg-Team – 8.1.0 Germanized für WooCommerce von vendidero – 3.1.6 WooCommerce PDF Invoices & Packing Slips von Ewout Fernhout – 2.4.10 WooCommerce von Automattic – 4.1.0 Opening Hours von Jannik Portz – 2.2.1
Thanks for the extra info @ajgw .
Based on the log error, it looks like the issue is related to WC()->cart
being null / unavailable. This is the affected line of code: https://github.com/woocommerce/storefront/blob/master/inc/woocommerce/storefront-woocommerce-template-functions.php#L77
At that state it was Storefront 2.5.5.
Is the issue still occurring with Storefront 2.5.6?
How often does this happen - weekly, daily, more often?
On one of the sites I saw it only pne time at end of april.
On other site we had it last year few times, at beginning this year and end of april both two times, each with few days between them.
Til update to 2.5.6 we had any error of this kind.
Yesterday I have updated Storefront to version 2.5.7 and error came up in log file with same output again on one client site. Any idea?
Thanks for the update @ajgw - strange to hear this occurred again.
Apart from the error in the log, is this affecting your sites in any other ways? If it's not easily reproducible and not causing problems, perhaps we could close the issue.
Well because I am not online on client stores at all. But I did not get any comment from client that some is not working. On the other hand how do we know if we lost orders because of this? Thanks.
I have also been seeing this fatal/critical error for the past year over whatever version of the plugin has been current, as it has been kept up to date. The first was in June 2019 then from Feb 2020 it has become more regular. 2020 occurrences: 2 in Feb, 6 in Apr, 18 in May, 6 so far in June. Examples from server error log. Some bracketed numbers () have changed:
[11-Jun-2019 17:47:49 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_cart_subtotal() on null in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php:77
Stack trace:
#0 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php(120): storefront_cart_link()
#1 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(286): storefront_header_cart('')
#2 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#3 /home/xxuserxx/public_html/wp/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
#4 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/header.php(46): do_action('storefront_head...')
#5 /home/xxuserxx/public_html/wp/wp-includes/template.php(722): require_once('/home/xxuserxx/...')
#6 /home/xxuserxx/public_html/wp/wp-includes/template.php(671): load_template('/home/xxuserxx/...', true)
#7 /home/xxuserxx/public_html/wp/wp-includes/general-temp in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php on line 77
[07-Feb-2020 16:21:52 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_cart_subtotal() on null in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php:77
Stack trace:
#0 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php(120): storefront_cart_link()
#1 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(288): storefront_header_cart('')
#2 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array)
#3 /home/xxuserxx/public_html/wp/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#4 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/header.php(46): do_action('storefront_head...')
#5 /home/xxuserxx/public_html/wp/wp-includes/template.php(722): require_once('/home/xxuserxx/...')
#6 /home/xxuserxx/public_html/wp/wp-includes/template.php(671): load_template('/home/xxuserxx/...', true)
#7 /home/xxuserxx/public_html/wp/wp-includes/general-temp in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php on line 77
[17-Jun-2020 09:49:14 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_cart_subtotal() on null in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php:77
Stack trace:
#0 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php(120): storefront_cart_link()
#1 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(287): storefront_header_cart('')
#2 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
#3 /home/xxuserxx/public_html/wp/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#4 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/header.php(48): do_action('storefront_head...')
#5 /home/xxuserxx/public_html/wp/wp-includes/template.php(723): require_once('/home/xxuserxx/...')
#6 /home/xxuserxx/public_html/wp/wp-includes/template.php(672): load_template('/home/xxuserxx/...', true)
#7 /home/xxuserxx/public_html/wp/wp-includes/general-temp in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php on line 77
[17-Jun-2020 09:49:15 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_cart_subtotal() on null in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php:77
Stack trace:
#0 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php(120): storefront_cart_link()
#1 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(287): storefront_header_cart('')
#2 /home/xxuserxx/public_html/wp/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
#3 /home/xxuserxx/public_html/wp/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#4 /home/xxuserxx/public_html/wp/wp-content/themes/storefront/header.php(48): do_action('storefront_head...')
#5 /home/xxuserxx/public_html/wp/wp-includes/template.php(723): require_once('/home/xxuserxx/...')
#6 /home/xxuserxx/public_html/wp/wp-includes/template.php(672): load_template('/home/xxuserxx/...', true)
#7 /home/xxuserxx/public_html/wp/wp-includes/general-temp in /home/xxuserxx/public_html/wp/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php on line 77
As far as active plugins, there is no overlap with @ajgw 's list of plugins, apart from Yoast SEO on one of his sites and Woocommerce itself (4.1.0). Storefront is currently 2.5.7. I have the (child?) theme Boutique 2.0.17 installed too.
I am concerned that these errors are intensifying and it will cause loss of customers.
Thanks for reporting what you're seeing @citobori .
I agree that it would be great if we could track down the cause of this error and fix the underlying problem.
Do you have any more details or info that could help us reproduce the problem? For example, what pages/routes on your sites does it happen on. Can you reproduce the issue reliably - if so, what are the steps? Thanks for your help :)
Folks, I suspect these errors are happening while WooCommerce or the theme is being updated. There's a short window when updates are happening where visitors to a site might hit the website right as the files are being replaced and in that short window the Cart might not be available in memory.
Depending on the deploy strategy being used for site updates (Native updates in WordPress, or some other update strategy) the errors could be more or less prevalent. It also likely is impacted that the amount of traffic that might be happening on the site at the time of the update.
@haszari the only thing we could do here is to verify the cart
is actually available before attempting to use methods on the expected instance. That would prevent the fatals showing up in the logs.
I can not reproduce error, but I do see error on two really different client sites and may ask what the reason can be. This is what I see on both client sites but with different timestamps:
2020-04-21T12:59:27+00:00 CRITICAL Uncaught Error: Call to a member function get_cart_subtotal() on null in …/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php:77 Stack trace:
0 …/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php(120): storefront_cart_link()
1 …/wp-includes/class-wp-hook.php(287): storefront_header_cart('')
2 …/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
3 …/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
4 …/wp-content/themes/storefront/header.php(48): do_action('storefront_head...')
5 …/wp-includes/template.php(723): require_once('/www/htdocs/w00...')
6 …/wp-includes/template.php(672): load_template('/www/htdocs/w00...', true)
7 …/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php in Zeile 77
2020-04-21T12:59:30+00:00 CRITICAL Uncaught Error: Call to a member function get_cart_subtotal() on null in …/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php:77 Stack trace:
0 …/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php(120): storefront_cart_link()
1 …/wp-includes/class-wp-hook.php(287): storefront_header_cart('')
2 …/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
3 …/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
4 …/wp-content/themes/storefront/header.php(48): do_action('storefront_head...')
5 …/wp-includes/template.php(723): require_once('/www/htdocs/w00...')
6 …/wp-includes/template.php(672): load_template('/www/htdocs/w00...', true)
7 /www/htdocs/w0 in …/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php in Zeile 77