I am having error on my website related to Woocommerce plugin. The error is given below…
Kindly help or guide me how to rectify it. I tried the recovery mode, and resumed the plugin. Then the website works normally. But when I logout from my dashboard and open the frontpage of the website then I get the error message as: There has been a critical error on this website. Learn more about troubleshooting WordPress.
The error details in plugin page in recovery mode are as follows –
An error of type E_ERROR was caused in line 19 of the file /home1/dsvidtyp/dpakola.com/wp-content/plugins/woocommerce/includes/class-wc-api.php. Error message: Uncaught Error: Class "WC_Legacy_API" not found in /home1/dsvidtyp/dpakola.com/wp-content/plugins/woocommerce/includes/class-wc-api.php:19 Stack trace: #0 /home1/dsvidtyp/dpakola.com/wp-content/plugins/woocommerce/includes/class-wc-autoloader.php(54): include_once() #1 /home1/dsvidtyp/dpakola.com/wp-content/plugins/woocommerce/includes/class-wc-autoloader.php(98): WC_Autoloader->load_file('/home1/dsvidtyp...') #2 [internal function]: WC_Autoloader->autoload('wc_api') #3 /home1/dsvidtyp/dpakola.com/wp-content/plugins/woocommerce/src/Internal/Utilities/LegacyRestApiStub.php(61): class_exists('WC_API') #4 [internal function]: Automattic\WooCommerce\Internal\Utilities\LegacyRestApiStub::parse_legacy_rest_api_request(Object(WP)) #5 /home1/dsvidtyp/dpakola.com/wp-content/plugins/woocommerce/src/Internal/Traits/AccessiblePrivateMethods.php(178): call_user_func_array(Array, Array) #6 /home1/dsvidtyp/dpakola.com/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Internal\Utilities\LegacyRestApiStub::__callStatic('parse_legacy_re...', Array) #7 /home1/dsvidtyp/dpakola.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #8 /home1/dsvidtyp/dpakola.com/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #9 /home1/dsvidtyp/dpakola.com/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array) #10 /home1/dsvidtyp/dpakola.com/wp-includes/class-wp.php(813): WP->parse_request('') #11 /home1/dsvidtyp/dpakola.com/wp-includes/functions.php(1336): WP->main('') #12 /home1/dsvidtyp/dpakola.com/wp-blog-header.php(16): wp() #13 /home1/dsvidtyp/dpakola.com/index.php(17): require('/home1/dsvidtyp...') #14 {main} thrown
Kindly help. It will be very helpful for me. I am stuck right now…!
Hey there, @vsacad! Thanks for contacting us. I’m happy to help you.
We suspect this issue is related with deleted files continuing to appear in the server as a result of a corrupted installation process.
For many users, manually removing the WooCommerce 9.0 plugin, and re-uploading the WooCommerce 9.0 plugin directory from the WooCommerce WordPress Plugin Page fixed the issue.
Users have also reported fixing the issue by installing WooCommerce 9.0 via wp-cli.
If the fixes above do not stop the Fatal error: Uncaught Error: Class 'WC_Legacy_API' not found... error from appearing, please revert to WooCommerce 8.9.3.
We have implemented a temporary fix that prevents the fatal error from occurring (#48593). However, this does not address the root cause of why deleted files continue to appear on servers.
We are actively investigating the root cause in order to implement a permanent resolution to this issue.
If you wish, you can keep an eye on this post for future updates on this issue.
I hope this was clarifying. If you face any issues or have any questions, please let us know so we can assist you further.
@vsacad, would you be happy to share your system status report and, if you don’t mind, could you let us know who your web host is? We’re also quite puzzled by this error, so any further information like this could be really helpful.
It is depressing that Automattic made this release without testing PROPERLY!!
You’re repeating this in various threads, and I understand your frustration entirely, but I’m not sure it is helpful. We performed extensive testing prior to releasing, and in fact I am not sure if we could reasonably have caught this specific problem ahead-of-time.
A lot of users do not know how to use WP-CLI!!
Please suggest more friendly options.
Perhaps it was missed, but I believe my colleague did also suggest the following:
For many users, manually removing the WooCommerce 9.0 plugin, and re-uploading the WooCommerce 9.0 plugin directory from the WooCommerce WordPress Plugin Page fixed the issue.
To expand on this a little more, you don’t necessarily even have to deactivate and delete the plugin to begin with, you can download the latest version, then upload it and overwrite the existing copy via Plugins ‣ Add New Plugin ‣ Upload Plugin (then verify you wish to replace the existing version).
However, 9.0.1 is now available, and it may be even easier to simply update to that version.
I’m glad that your website is working now, but from what I understand, it is working on 8.9.3, correct?
As my colleague asked, do you mind sharing the System Status Report which you can find via WooCommerce > Status > Get system report > Copy for support, and let us know who your host is, so we can investigate this further?
I understand that you are facing an issue where only Home is loading fine and all other links are showing a critical error. Is my understanding correct?
Let’s try this step and see if the other pages are loading. Log in to the Dashboard and go to Settings → Permalinks and choose Plain.
If the error persists, try disabling all plugins except WooCommerce and checking again. Let me know how it goes. 🙂
The original issue in this thread is reportedly resolved, @vsacad .
Moreover, you are reporting to have discovered that while re-activating plugins one-by-one, after changing the permalinks structure, the critical error reported here started appearing again when the WooCommerce Stripe Gateway plugin was activated. Odd, but you were able to proceed by utilizing another one in its place.
The issues reported in this thread appear to be resolved now — correct.
Should you wish looking further into the issue with the WooCommerce Stripe Gateway plugin, feel free to post here.