Troubleshooting Common WooCommerce Fatal Errors and PHP Notices
Content
Encountering a sudden fatal error or a log file filling up with warnings after a WooCommerce update is a common and frustrating experience for store owners. These errors can range from minor notices to full-site crashes. Based on community reports, this guide covers the most frequent culprits and provides steps to diagnose and resolve them.
Why Do These Errors Occur?
Most errors arise from a few key sources:
- Plugin or Theme Conflicts: An extension or your theme may not be fully compatible with the latest version of WooCommerce or PHP.
- Incomplete Updates: Files may not have updated correctly during the process, leading to missing classes or functions.
- Outdated Code: Custom code or older plugins might use methods that have been deprecated or changed in newer versions of WooCommerce or PHP.
- Server Configuration: Issues with .htaccess rules, PHP extensions, or memory limits can also trigger errors.
Common Errors and Their Solutions
1. Fatal Error: strpos() expects parameter 1 to be string, null given
This error, often pointing to files like WcPayWelcomePage.php or BlockPatterns.php, has been widely reported.
Solution: The WooCommerce team deployed a fix for a known issue with block patterns. To resolve it manually, you can clear the problematic transient data.
- Using WP-CLI: Run the command:
wp transient delete ptk_patterns --skip-themes --skip-plugins - Via Database (phpMyAdmin): Execute the SQL query:
DELETE FROM wp_options WHERE option_name = '_transient_ptk_patterns';(Remember to change thewp_prefix if your site uses a different one).
2. PHP Notice: Function called incorrectly
Notices like get_cart or wc_get_order being called incorrectly often indicate a code execution timing issue, usually caused by another plugin.
Solution:
- Enable WordPress debugging by adding
define( 'WP_DEBUG', true );anddefine( 'WP_DEBUG_LOG', true );to yourwp-config.phpfile. This will write errors to adebug.logfile in the/wp-content/directory. - Check the error log and backtrace. The backtrace will show which plugin is making the incorrect call (e.g.,
MWB_WGM_Card_Product_Function,Brightplugins_COS). - Temporarily disable the identified plugin and check if the notices stop.
- Reach out to the author of that specific plugin for an update compatible with the latest WooCommerce version.
3. Server Errors: AH01797 & LimitInternalRecursion
Errors mentioning mod_access_compat.c and denial of access to /woocommerce_uploads/ are related to server configuration.
Solution: This is typically caused by a conflict between WooCommerce's .htaccess rules in the uploads directory and your server's main configuration. Review your server's .htaccess files and Apache configuration for any conflicting rules that might be denying access or creating a redirect loop.
4. Fatal Error: Class Not Found (e.g., WC_Log_Levels)
This error suggests that essential WooCommerce files are missing or did not load correctly.
Solution:
- Re-install WooCommerce: The most straightforward fix is to perform a clean re-install. Go to Plugins > Installed Plugins, deactivate and delete WooCommerce. Then, install it again from the WordPress repository. Do not worry; your order and product data are safe in your database and will not be deleted.
- Ensure your WordPress, theme, and all other plugins are also updated to their latest versions to ensure compatibility.
5. Maximum Execution Time or Memory Limit Exhausted
Errors like Allowed memory size of X bytes exhausted or Maximum execution time exceeded often occur on product or checkout pages handling large amounts of data.
Solution:
- Increase PHP limits temporarily. You can add the following lines to your
wp-config.phpfile:define( 'WP_MEMORY_LIMIT', '512M' ); set_time_limit( 180 ); - If this resolves the issue, it indicates a theme or plugin is highly inefficient. Use the Health Check & Troubleshooting plugin to disable plugins and switch to a default theme in a troubleshooting session to identify the resource-heavy culprit.
General Troubleshooting Steps
If you are unsure of the specific error, follow this standard procedure:
- Enable Debugging: Turn on
WP_DEBUG_LOGas shown above to get detailed error information. - Conflict Test: Disable all plugins except WooCommerce and switch to a default WordPress theme like Storefront. If the error disappears, re-enable your plugins and theme one by one to identify which one is causing the conflict.
- Check for Updates: Ensure everything—WordPress, WooCommerce, your theme, and all plugins—is completely up to date.
- Review Error Logs: Check your hosting provider's error logs (often found in a panel like cPanel) for more detailed server-level messages.
Persistent problems often have existing solutions. Searching the WooCommerce community support forums or GitHub issues page for the specific error message can often lead you to a known bug and its workaround or fix.
Related Support Threads Support
-
My site shows a blank white screen, likely caused by WooCommerce.https://wordpress.org/support/topic/%e6%88%91%e7%9a%84%e7%bd%91%e7%ab%99%e5%87%ba%e7%8e%b0%e4%ba%86%e7%99%bd%e5%b1%8f%ef%bc%8c%e4%bc%bc%e4%b9%8e%e4%b8%8ewoocommerce%e6%9c%89%e5%85%b3/
-
Unable to activate Opayo payment suite after upgrade to 9.7https://wordpress.org/support/topic/unable-to-activate-opayo-payment-suite-after-upgrade-to-9-7/
-
Encountering a fatal error in versions 9.6.1 and 9.6.2.https://wordpress.org/support/topic/encountering-a-fatal-error-in-versions-9-6-1-and-9-6-2/
-
Fatal error BlockPatterns.php:251https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/
-
Customizer not opening, getting a “type E_ERROR”https://wordpress.org/support/topic/customizer-not-opening-getting-a-type-e_error/
-
New emails after Woocommerce update causing fatal errorshttps://wordpress.org/support/topic/new-emails-after-woocommerce-update-causing-fatal-errors/
-
price.php errors/warnings when updating to 9.8.2https://wordpress.org/support/topic/price-php-failed-to-open-stream-when-updating-to-9-8-2/
-
Fatal error: Maximum execution time of 120 seconds exceededhttps://wordpress.org/support/topic/fatal-error-maximum-execution-time-of-120-seconds-exceeded/
-
Updating to 9.8.1 leads to a lot of LimitInternalRecursion errorshttps://wordpress.org/support/topic/updating-to-9-8-1-leads-to-a-lot-of-limitinternalrecursion-errors/
-
Fatal error: Uncaught TypeError: strpos(): Argument #1 ($haystack)…https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-strpos-argument-1-haystack/
-
Your Site is Experiencing a Technical Issuehttps://wordpress.org/support/topic/your-site-is-experiencing-a-technical-issue-145/
-
Fatal error with PHP 8.2https://wordpress.org/support/topic/fatal-error-with-php-8-2-6/
-
Fatal error when I submit the “Password recovery” formhttps://wordpress.org/support/topic/fatal-error-when-i-submit-the-password-recovery-form/
-
Critical Errorhttps://wordpress.org/support/topic/critical-error-781/
-
Critcial error on sitehttps://wordpress.org/support/topic/critcial-error-on-site/
-
PHP Errorhttps://wordpress.org/support/topic/php-error-685/
-
WooCommerce Fatal Error Alert (BlockPatterns.php)https://wordpress.org/support/topic/woocommerce-fatal-error-alert-blockpatterns-php/
-
Issue with 9.8.5https://wordpress.org/support/topic/issue-with-9-8-5/
-
Fatal error: Uncaught Errorhttps://wordpress.org/support/topic/fatal-error-uncaught-error-113/
-
“Doing it wrong” message in error loghttps://wordpress.org/support/topic/doing-it-wrong-message-in-error-log/
-
Fatal Errorhttps://wordpress.org/support/topic/fatal-error-4857/
-
php Fatal error: Uncaught ValueError: Missing format specifier at end of stringhttps://wordpress.org/support/topic/php-fatal-error-uncaught-valueerror-missing-format-specifier-at-end-of-string-2/
-
Undefined array keyhttps://wordpress.org/support/topic/undefined-array-key-59/
-
After updating to PHP 8.1 error PHP Notice: Function WP_Block_Patterns_Registry:https://wordpress.org/support/topic/after-updating-to-php-8-1-error/
-
Error log full of wc_get_order was called incorrectlyhttps://wordpress.org/support/topic/error-log-full-of-wc_get_order-was-called-incorrectly/
-
Woocommerce crashing WordPress Admin when activatedhttps://wordpress.org/support/topic/woocommerce-crashing-wordpress-admin-when-activated/
-
Woocommerce 9.8.4 fatal error when refunding order with Redis Object Cache plugihttps://wordpress.org/support/topic/woocommerce-9-8-4-fatal-error-when-refunding-order-with-redis-object-cache-plugi/
-
fatal-errors-2025-03-26https://wordpress.org/support/topic/fatal-errors-2025-03-26/
-
fatal-errors-2025-04-03https://wordpress.org/support/topic/fatal-errors-2025-04-03/
-
Fatal errorhttps://wordpress.org/support/topic/fatal-error-4860/
-
Trying to access array offset on value of type boolhttps://wordpress.org/support/topic/trying-to-access-array-offset-on-value-of-type-bool-47/
-
fatal-errors-2025-03-06https://wordpress.org/support/topic/fatal-errors-2025-03-06/