With the release of WooCommerce 8.5, some users have reported a bug that’s affecting their website due to a Fatal Error.
What’s the Issue?
Some users who have upgraded to WooCommerce 8.5 are encountering a dreaded “White Screen of Death” due to a fatal error:
Fatal error: Uncaught Error: Using $this when not in object context in /wp-content/plugins/woocommerce/src/Internal/Features/FeaturesController.php:340 Stack trace: #0 /wp-content/plugins/woocommerce/src/Internal/Admin/Marketplace.php(23): Automattic\WooCommerce\Internal\Features\FeaturesController::change_feature_enable('marketplace', true) #1 [internal function]: Automattic\WooCommerce\Internal\Admin\Marketplace->init() #2 /wp-content/plugins/woocommerce/src/Internal/DependencyManagement/Definition.php(59): call_user_func_array(Array, Array) #3 /wp-content/plugins/woocommerce/src/Internal/DependencyManagement/Definition.php(29): Automattic\WooCommerce\Internal\DependencyManagement\Definition->invokeInit(Object(Automattic\WooCommerce\Internal\Admin\Marketplace)) #4 /wp-content/plugins/woocommerce/lib/packages/Leagu in /wp-content/plugins/woocommerce/src/Internal/Features/FeaturesController.php on line 340
The troublemaker is a non-static method call within WooCommerce’s FeaturesController.php
, leading to a fatal error. This error effectively breaks the site, leading to what’s commonly known as the “White Screen of Death”.
Technical details aside, this means your WooCommerce site could be down – and in the world of e-commerce, every minute counts.
Interim Solution 1: Using WP-CLI
For those familiar with WP-CLI, here’s a quick fix. Running the following command will sort out the issue:
wp --skip-plugins option update woocommerce_feature_marketplace_enabled yes
This command enables the WooCommerce Marketplace feature, which seems to be at the heart of the problem. Enabling it before updating to 8.5 can also prevent the fatal error from occurring.
Interim Solution 2: Downgrading WooCommerce
If WP-CLI sounds like a foreign language to you, don’t worry. The other solution is to downgrade your WooCommerce plugin back to version 8.4.0.
Here’s a step-by-step guide:
- Deactivate WooCommerce: If you can access your WordPress Admin, navigate to ‘Plugins’, find WooCommerce, and click ‘Deactivate’.
- Delete the Current Version: After deactivation, click ‘Delete’ to remove the current version of WooCommerce. Don’t worry, your data is safe.
- If you can’t access WordPress Admin: Access your WordPress files with FTP/SFTP/SSH/File Manager and remove the directory:
/wp-content/plugins/woocommerce
- Download WooCommerce 8.4.0: Click this download link from the WordPress repository to download WooCommerce 8.4.0 file to your computer.
- Install the Downgraded Version: In your WordPress Admin, go to Plugins > Add New > Upload Plugin. Upload the file you just downloaded and activate the plugin.
- Check Your Site: Ensure that everything is running smoothly and that no data was lost during the downgrade.
Conclusion
While neither of these solutions is ideal, they’ll help you keep your WooCommerce store running without the fatal error of version 8.5.
As always, stay tuned for updates from WooCommerce, as they’re working on a permanent fix in the next release.