You open your shop and instead of products you get a white page with one sentence: “There has been a critical error on this website. Please check your site admin email inbox for instructions.” Sometimes only the Shop or Checkout page is broken, sometimes the whole admin is gone too. In this tutorial, we will learn how to fix the WooCommerce critical error the right way: find the exact file and line that crashed using the WooCommerce error log, then fix or disable the code responsible.
To make the screenshots real, I broke a fresh WooCommerce 11.3 store on purpose with a small custom snippet, exactly the kind of code people paste into a “custom snippets” plugin or into functions.php.
Contents
- What the WooCommerce critical error actually means
- Step 1: See the real error message
- Step 2: Open WooCommerce > Status > Logs
- Step 3: Can’t reach the admin? Enable the WordPress debug log
- Step 4: Fix or disable the code that crashed
- Step 5: Still broken? Grab the system status report
- Common errors and what they mean
- Wrapping up
What the WooCommerce critical error actually means
“Critical error” is WordPress’s friendly name for a PHP fatal error: PHP hit something it cannot recover from and stopped executing the page. Since WordPress 5.2, instead of showing the raw PHP error to visitors, WordPress shows the generic critical error message and emails the site admin a link to recovery mode.
The most common causes in a WooCommerce store are:
- A custom code snippet calling a function that does not exist, or that a plugin update removed.
- A plugin or theme that is not compatible with your WooCommerce, WordPress or PHP version (very common right after updates).
- A template override in your theme (
yourtheme/woocommerce/) that is too old for the current WooCommerce. - Running out of memory (
Allowed memory size of ... bytes exhausted).
The fix depends entirely on the cause, so the first job is always the same: read the error.
Step 1: See the real error message
When WP_DEBUG_DISPLAY is enabled (for example on a staging site), PHP prints the full fatal error instead of the friendly message. This is what my broken shop page looked like:
The two parts that matter are the error type and the location: Call to undefined function wc_get_loop_product_count_total(), thrown in wp-content/mu-plugins/my-custom-snippets.php on line 5. That tells us exactly which file to look at.
Never turn on error display on a live store. Use the WooCommerce log in Step 2 or the debug log in Step 3 instead, because they record the same information without showing it to customers.
Step 2: Open WooCommerce > Status > Logs
WooCommerce catches fatal errors and writes them to its own log, even when the front end only shows the friendly message. If you can still reach the admin, go to WooCommerce > Status and click the Logs tab. Look for a log with the source fatal-errors and the date the problem started.
Click it to open the log file. Each line shows the time, the level (Critical) and the full error message with the file path and line number:
Expand Additional context to see the backtrace, which shows which hook called the broken code. In my case it was template_redirect, which is why every visit to the Shop page crashed while the admin still worked.
Step 3: Can’t reach the admin? Enable the WordPress debug log
If the critical error also breaks /wp-admin/, you have two options. First, check the email inbox of the site admin address: WordPress sends a message with a special recovery mode link that lets you log in with the broken plugin paused. Second, connect over SFTP or your hosting file manager and enable the debug log in wp-config.php, above the line /* That's all, stop editing! */:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 );
Reload the broken page once, then open wp-content/debug.log. The last lines contain the same PHP Fatal error message with the file and line. When you are done, set WP_DEBUG back to false and delete debug.log, because it can contain information you do not want public.
Step 4: Fix or disable the code that crashed
Now use the file path from the error to find the culprit:
wp-content/plugins/plugin-name/...: a plugin. Update it if an update is available, otherwise deactivate it under Plugins. If the admin is down, rename its folder over SFTP (for example toplugin-name-off) and WordPress will deactivate it.wp-content/themes/theme-name/...: your theme or child theme, oftenfunctions.phpor an outdated WooCommerce template override.wp-content/mu-plugins/...: a must-use plugin. These do not appear in the normal plugin list and cannot be deactivated with a click, so many people forget they exist. You can see them under Plugins > Must-Use.
In my example, the snippet called wc_get_loop_product_count_total(), a function that does not exist in WooCommerce. Here is the broken code and the fixed version, which uses the real wc_get_loop_prop() helper and only runs when WooCommerce is loaded:
// Broken: undefined function = fatal error on every Shop page visit
add_action( 'template_redirect', function () {
if ( is_shop() ) {
$count = wc_get_loop_product_count_total();
wc_add_notice( sprintf( '%d products in the shop', $count ), 'notice' );
}
} );
// Fixed: run inside the shop loop and use a function that exists
add_action( 'woocommerce_before_shop_loop', function () {
if ( function_exists( 'wc_get_loop_prop' ) ) {
echo '<p class="shop-count">' . esc_html( wc_get_loop_prop( 'total' ) ) . ' products</p>';
}
} );
If you are not sure how to fix someone else’s code, simply removing the snippet (or deactivating the plugin) brings the store back immediately. You can then fix it calmly on a staging copy. After removing the snippet, my shop page loaded normally again:
Step 5: Still broken? Grab the system status report
If the log points to a plugin you did not write, contact that plugin’s support with two things: the exact error line from the log, and your system status report. Go to WooCommerce > Status, click Get system report and then Copy for support. The report lists your WordPress, WooCommerce and PHP versions, active plugins and outdated template overrides, which is usually the first thing support asks for.
Common errors and what they mean
Call to undefined function / Class “…” not found
Code calls something that is not loaded: a typo, a function removed in a plugin update, or a plugin that runs before WooCommerce is loaded. Wrap WooCommerce calls in function_exists() or hook them to a later action.
Allowed memory size of 134217728 bytes exhausted
PHP ran out of memory. Raise the limit with define( 'WP_MEMORY_LIMIT', '256M' ); in wp-config.php (WooCommerce recommends at least 256 MB) and ask your host to raise the PHP memory_limit if needed.
The error started right after an update
Check the log for the plugin folder name in the path. Roll that plugin back to the previous version or wait for a fix, and next time test updates on staging first. The same troubleshooting logic applies on other platforms too, as I explained in how to fix the Magento 2 500 internal server error.
The official WooCommerce developer docs explain how the WooCommerce logging system works, and the WordPress handbook covers debugging in WordPress in more detail.
Wrapping up
A WooCommerce critical error is just a PHP fatal error hiding behind a friendly message. Read the fatal-errors log under WooCommerce > Status > Logs (or debug.log when the admin is down), follow the file path to the plugin, theme or snippet that crashed, then fix or disable it. Most of the time the store is back within minutes.
If your log shows an error you cannot decode, paste the error line (without any passwords or keys) in the comments below and I will take a look.







