Skip to content
WooRescueHQ

WooCommerce / Errors

WooCommerce Fatal Error: A Practical Troubleshooting Guide

Short answer

The message customers see is generic; the real error is in a log. Look in WooCommerce → Status → Logs (fatal-errors), the PHP error log, or wp-content/debug.log. Read four things: the error type and message, the file path (which plugin, theme or custom code), the stack trace (how WooCommerce reached that code) and the timestamp (which change triggered it). Then fix or roll back that component — not WooCommerce as a whole.

Symptoms

  • There has been a critical error on this website on the shop, product pages, checkout or admin.
  • A white screen or an HTTP 500 response.
  • Checkout that keeps loading because its request fails with a 500.
  • An email to the site administrator titled Your Site is Experiencing a Technical Issue.

Most common causes

Error message Typical cause
Uncaught TypeError: Unsupported operand types: string + float Custom code doing arithmetic on a value that is not a number — stricter on PHP 8
Call to a member function get_id() on bool / on null Code assumes wc_get_order() or wc_get_product() found something
Call to undefined function … A required plugin is inactive or was updated without its dependency
Cannot redeclare … / Cannot declare class … The same snippet in two places, or two plugins bundling the same library
Allowed memory size of … bytes exhausted A loop or query loading far too much data, or a genuinely heavy task
Maximum execution time of … seconds exceeded A slow external call or query, often inside checkout or an import
Class "…" not found An incomplete update, a broken autoloader or a missing Composer dependency

Diagnosis

1. Get the full error

In order of convenience:

  1. The email WordPress sends to the administrator when it catches a fatal error.
  2. WooCommerce → Status → Logs, source fatal-errors.
  3. The PHP error log in your hosting panel.
  4. wp-content/debug.log, after enabling logging:
PHPwp-config.php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );      // or a path outside the web root
define( 'WP_DEBUG_DISPLAY', false ); // never show errors to customers
@ini_set( 'display_errors', '0' );

2. Read it in four parts

Log
PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string + float
  in /var/www/wp-content/plugins/custom-fees/custom-fees.php:142
Stack trace:
#0 /var/www/wp-includes/class-wp-hook.php(324): add_custom_fee(Object(WC_Cart))
#1 /var/www/wp-includes/plugin.php(205): WP_Hook->apply_filters(...)
#2 /var/www/wp-content/plugins/woocommerce/includes/class-wc-cart.php(...): do_action('woocommerce_cart_calculate_fees', ...)
  • Type and message: a TypeError — wrong types, not a missing file.
  • File and line: custom-fees.php:142 — a custom plugin, not WooCommerce.
  • Stack trace: WooCommerce reached it while calculating cart fees.
  • Timestamp (in the log line prefix): match it with the last update, deployment or PHP change.

3. Connect it to a change

Look at what changed just before the first occurrence: plugin and theme updates, a new snippet, a PHP version change, a WooCommerce update that changed what a hook passes. Most fatal errors are the first run of new code paths after a change.

Logs and technical checks

  • fatal-errors log, PHP error log, debug.log.
  • WooCommerce → Status → System status: PHP version, memory limit, WooCommerce and extension versions.
  • The plugin's changelog for the version installed just before the error appeared.
  • For memory errors: which request, how often, and what it was loading.

Solutions

  • Roll back the component that introduced the error to its previous version, as a stopgap, while the real fix is prepared.
  • Fix the code defensively: check return values, cast types, and handle missing orders or products.
  • Update incompatible plugins for the current PHP and WooCommerce versions, or replace abandoned ones.
  • Remove duplicates: the same snippet in a snippets plugin and in functions.php, or two plugins that bundle conflicting libraries.
  • For time and memory limits, fix what is slow or heavy; raise limits only for legitimate heavy jobs, ideally in the background.
PHPcustom-fees/custom-fees.php
// Before: fatal when get_option() returns a string
$fee = $cart->get_subtotal() * get_option( 'handling_rate' );

// After: explicit types, and nothing to add when the rate is not set
$rate = (float) get_option( 'handling_rate', 0 );
if ( $rate > 0 ) {
    $cart->add_fee( __( 'Handling', 'my-store' ), $cart->get_subtotal() * $rate );
}

What not to do

  • Do not enable error display on a live store; log errors instead.
  • Do not edit a third-party plugin's files on production. The change is lost at the next update and nobody knows it exists.
  • Do not reinstall WooCommerce or restore an old backup without knowing the cause — you may lose orders and keep the bug.
  • Do not delete the log after reading it; you will need it to confirm the fix.

When to contact an expert

Contact an engineer when the error is inside custom code or a premium extension you cannot safely change, when it is intermittent, when it appeared after a PHP upgrade across many files, or when it blocks checkout or the admin right now.

Frequently asked questions

What does “There has been a critical error on this website” mean?

WordPress caught a PHP fatal error and stopped rendering the page. The administrator usually receives an email with details and a recovery-mode link. The exact error is in the PHP or WooCommerce logs.

How do I enable WordPress debug logging safely?

Set WP_DEBUG and WP_DEBUG_LOG to true and WP_DEBUG_DISPLAY to false in wp-config.php. Errors are written to wp-content/debug.log (or a path you choose) and never shown to visitors. Disable it again when you are done.

Should I increase the PHP memory limit?

Only if the error is “Allowed memory size exhausted” and the operation genuinely needs more memory, such as a large import. If an ordinary page exhausts memory, something is looping or loading far too much data.

Why did the error start after a PHP upgrade?

PHP 8 is stricter: operations that produced warnings on PHP 7 — arithmetic on strings, wrong argument types, undefined functions — now throw errors. Old plugins and custom code are the usual culprits.

$ describe the problem

Have a WooCommerce problem?Request a diagnosis.

Tell us what is failing, what changed recently and the business impact. We review every request and recommend the appropriate next step.

Request a diagnosis See services and prices

Never send passwords, API keys or card data through the form.

Diagnosis from€299

Request a diagnosis