Occasional PHP Error on Admin Notice
-
Hi,
Occasionally, we get this error:
`[Fri Jun 18 16:51:17.200295 2021] [php7:error] [pid 17363] [client 99.231.180.74:48442] PHP Fatal error: Uncaught Exception: Invalid data store. in /nas/content/live/our_site/wp-content/plugins/woocommerce/includes/class-wc-data-store.php:107\nStack trace:\n#0 /nas/content/live/our_site/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(139): WC_Data_Store->__construct(‘admin’)\n#1 /nas/content/live/our_site/wp-content/plugins/advanced-local-pickup-for-woocommerce/include/wclp-wc-admin-notices.php(58): WC_Data_Store::load(‘admin-note’)\n#2 /nas/content/live/our_site/wp-includes/class-wp-hook.php(287): WC_ALP_Admin_Notices_Under_WC_Admin->admin_notices_for_alp_pro(”)\n#3 /nas/content/live/our_site/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)\n#4 /nas/content/live/our_site/wp-includes/plugin.php(484): WP_Hook->do_action(Array)\n#5 /nas/content/live/our_site/wp-settings.php(557): do_action(‘init’)\n#6 /nas/content/live/our_site/wp-config.php(87): require_once(‘/nas/content/li…’)\n#7 /nas/content/live/our_site/wp-load.php(37): re in /nas/content/live/our_site/wp-content/plugins/woocommerce/includes/class-wc-data-store.php on line 107
This thread suggests it’s because the WC_Data_Store::load() is called too early:
https://github.com/woocommerce/woocommerce-admin/issues/3869
It looks like you’ve got this hooked to init. Could this be changed to hook to plugins_loaded to ensure that WooCommerce is loaded and the data store is correctly registered?
- The topic ‘Occasional PHP Error on Admin Notice’ is closed to new replies.