How to fix a Critical Error on a Managed WooCommerce Site
July 12, 2021 | Known Issues, Troubleshooting, WooCommerce
The Managed WooCommerce platform requires that the Woo plugin be installed and active. When deleting WooCommerce to try to resolve a critical error the site then returns a new critical error. This error will be easy to distinguish because it will not be referencing a problem with a file in the /wp-content/plugins folder, but instead in the /wp-content/mu-plugins/ folder (see screenshot) which is managed by the platform and that we don’t control. Basically, there are plugins with Woo dependencies built into the platform, so when Woo isn’t installed those dependent plugins cause a critical error.
The fix for this is to install and activate WooCommerce again. That can be tricky when there’s a critical error on the site. You can accomplish this quickly and easily by installing and activating the plugin via SSH and WPCLI instead.
Step 1: Enable SSH in the MYA
Go to the customers account and navigate to the Settings dashboard for the MWC site.
Toggle the SSH option to to enabled position.
Step 2: Login to SSH
On your Windows console, search for “cmd” and open the Command Prompt
Go back to the Managed WordPress Hosting dashboard and click on the “View” link next to SFTP/SSH details.
In the pop up, click the “Copy” link next to SSH command.
Go back to the Command prompt and paste (Crtl + v) the copied command into the command prompt box and hit the “Enter” key.
Upon your first time entering this, you will be prompted to continue. Type in “yes” and then hit the “Enter” key.
Now you will be asked for a Password. Go back to your SFTP/SSH details box and click on the “Copy” link next to the “Password” field.
Go back to your command prompt and make sure your cursor is after the password section, right click in the black part of the prompt, hit the “Enter” key and wait for a moment. It will not display the copied password. It will simply move to the next prompt.
You should see “Authorized Access Only” like in the screenshot below
Step 3: Remove the WooCommerce plugin from the plugins file
In the command prompt copy and paste the following command to go to the plugins directory in the file structure. To paste; you will do what you did with the password and right click anywhere in the black. This time the text should appear, then click the “Enter” key.
cd html/wp-content/plugins/
Now copy and paste (right click in the black, then enter) the following code to remove the WooCommerce plugin.
rm -rf woocommerce
Step 4: Re-add WooCommerce
Go to https://wordpress.org/plugins/woocommerce/
Right click on the “Download” button and click the “copy link address” option.
Copy and Paste (right click in the black, then enter) the following code into the command prompt with the link you copied from the download button to install the plugin. It will look something like this:
wget https://downloads.wordpress.org/plugin/woocommerce.5.4.1.zip
This step might take a moment.
Now unzip the plugin file by replacing the Xs from the below code with the version you just downloaded and paste (right click in the black, then enter) the command into the command prompt.
The version will be listed at the end of the copied link from the previous step.
unzip woocommerce.X.X.X.zip
Remove the zip file now by replacing the X’s as before, and copy and paste (right click in the black, then enter) the following command into the command prompt:
rm woocommerce.X.X.X.zip
Lastly, activate WooCommerce by copy and pasting (right click in the black, then enter) the following command into the command prompt.
wp plugin activate woocommerce
This should resolve the critical error based on Managed WooCommerce dependencies, but there may be additional critical errors if issues exist with any other installed plugins.