Bug FixesAugust 3, 20267 min read

WooCommerce + PHP 8: the compatibility issues nobody warns you about.

You upgraded to PHP 8 and your WooCommerce checkout broke. Here are the specific functions that break, how to find them, and why your PHP compatibility checker might be missing them.

Upgrading PHP is supposed to make your site faster. And it does, until your WooCommerce checkout stops working and you start losing sales.

WooCommerce is one of the most PHP-sensitive plugins in the WordPress ecosystem. It uses hundreds of PHP functions, hooks into core WordPress deeply, and interacts with payment gateways that each have their own PHP requirements. When you flip the PHP switch, WooCommerce is usually the first thing that breaks.

Here are the specific compatibility issues I see most often when upgrading WooCommerce stores to PHP 8, and how to fix each one.

The PHP compatibility checker problem

Most guides tell you to run the PHP Compatibility Checker plugin before upgrading. That is good advice, but it has a blind spot: it checks PHP files for deprecated function calls, but it does not check runtime behavior.

Some PHP 8 issues are not about deprecated functions. They are about changed behavior:

  • PHP 8.0 made named arguments possible, which breaks functions that use func_get_args()
  • PHP 8.1 changed how null is handled in string functions (str_replace, trim, etc.)
  • PHP 8.1 warns on implicit float-to-int conversion, which WooCommerce does constantly for prices
  • PHP 8.2 deprecated dynamic properties, which some WooCommerce extensions still use

The compatibility checker will not catch these. Only staging testing will.

The 5 most common WooCommerce + PHP 8 breaks

1. Checkout fatal error: "Call to undefined function"

Your payment gateway plugin calls a WooCommerce function that was removed or renamed in a recent WooCommerce update. The gateway was not updated to match.

Fix: Update the payment gateway plugin. If the developer abandoned it, switch to a maintained alternative. Stripe and PayPal are well-maintained. But smaller gateways (local payment methods, regional processors) often lag behind.

2. Cart total shows $0 after PHP upgrade

WooCommerce calculates prices using float math. PHP 8.1 added a deprecation warning for implicit float-to-int conversion. If your WooCommerce version is old, these warnings fill up debug.log and can cause the cart total calculation to fail silently.

Fix: Update WooCommerce to the latest version. Modern WooCommerce handles float-to-int conversion correctly. If you are on WooCommerce 7.x or older, this is your problem.

3. "Deprecated: str_replace(): Passing null" warnings

PHP 8.1 deprecated passing null to string functions like str_replace(), trim(), and strtolower(). Many WooCommerce extensions pass null when a field is empty, instead of an empty string.

These are warnings, not fatal errors. Your site keeps working, but your debug.log fills up with thousands of lines, which can slow down the server and make debugging real problems impossible.

Fix: Update the extension that generates the warnings. If the developer has not fixed it, you can suppress deprecation warnings by setting error_reporting(E_ALL & ~E_DEPRECATED); in wp-config.php. This is a band-aid, not a fix, but it stops the log spam while you wait for an update.

4. Dynamic property deprecation (PHP 8.2)

PHP 8.2 deprecated creating dynamic properties on objects. WooCommerce core fixed this, but many extensions still assign properties dynamically without declaring them.

Symptoms: warnings in debug.log like "Creation of dynamic property WC_Gateway_XYZ::$custom_field is deprecated."

Fix: Update extensions. If the developer is inactive, you can add the #[AllowDynamicProperties] attribute to the class, but this requires editing plugin code (temporary fix, lost on update).

5. Order emails stop sending

WooCommerce order emails use PHP mailer hooks. Some SMTP plugins (especially older versions of WP Mail SMTP or FluentSMTP) broke on PHP 8 because they used create_function() or other removed features.

Symptoms: orders go through, but confirmation emails do not arrive. Customers think the order failed and submit again.

Fix: Update your SMTP plugin. If the problem persists, check debug.log for fatal errors during woocommerce_email_headers or phpmailer_init hooks.

The safe upgrade path for WooCommerce stores

  1. Update everything first. WooCommerce core, all extensions, all plugins, your theme. Do this on staging.
  2. Run PHP Compatibility Checker to catch deprecated function calls.
  3. Switch to PHP 8.2 on staging.
  4. Test the full purchase flow: add to cart, checkout, payment (use test mode), order confirmation email, order receipt page.
  5. Check debug.log for warnings. Warnings do not break the site but indicate old code that will eventually fail.
  6. Fix or replace deprecated plugins.
  7. Switch production. Do it during low-traffic hours. Monitor debug.log for the first 48 hours.

This is the same process I describe in my general PHP 8 upgrade guide, but for WooCommerce stores you must test the checkout flow specifically. A blog can survive with deprecation warnings. A store cannot.

If your WooCommerce store broke after a PHP upgrade and you are losing sales, message @wpservicelab on Telegram. Same-day WooCommerce fixes. See my bug fix service for pricing.

Have a site to recover?

Send the domain and a Wayback link. Honest scope and price before any work starts.

Get a quote