8 min read

WooCommerce Block Patterns Crash: What Happened and How to Protect Your Store

Shashank Dubey
Content & Marketing, Wbcom Designs · Published May 11, 2025 · Updated Nov 6, 2026
WooCommerce Bug Causing

On 6 May 2025, WooCommerce stores across the web started throwing a fatal PHP error that locked owners out of both the storefront and the admin. For many shops it meant a dead checkout until someone found the fix.

This post explains what the WooCommerce team says caused the crash, how stores recovered, and what you can set up so the next surprise costs you minutes instead of a day of sales.

Last updated: 6 November 2026

Quick answer

What caused the WooCommerce crash in May 2025? WooCommerce received malformed block pattern data from its remote pattern service, so a null category title reached strpos() in BlockPatterns.php and PHP threw a fatal error. WooCommerce 9.8.4, released 6 May 2025, added a guard. Stores that still crashed cleared the cached ptk_patterns transient.


The Incident: A Fatal Error in WooCommerce Block Patterns

What happened

According to the WooCommerce developer blog notice dated 6 May 2025, the plugin received incorrect block pattern data from the remote service that supplies its patterns. That data contained null where a string or array was expected. Stores that tried to update or load patterns around the time of the bad response saw the error below, or could not reach the storefront or admin at all.

Uncaught Error: strpos(): Argument #1 ($haystack) must be of type string, null given
in /wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php on line 251

A Search Engine Journal report notes that sites running WooCommerce 9.8.2 and 9.8.3 were among those affected, and that the WooCommerce GitHub repository attributed the problem to a bad response from the Woo pattern repository. Some sites had no recent update at all, which points to remote data rather than a changed plugin file.

The WordPress.org support thread for this error shows how quickly site owners hit the same wall.

The faulty line

The code assumed every pattern category carried a title string:

if (strpos($category['title'], $prefix) !== false) {

When $category['title'] arrived as null, PHP threw a TypeError instead of treating it as an empty string, and execution stopped. Under strict typing, one unexpected null is enough to take down a request.

The fix WooCommerce shipped

The WooCommerce 9.8.4 dot release, published the same day, includes a patch (pull request 57759) so the fatal error is not triggered when categories is null. WooCommerce also corrected the data at the source.

One detail caught many owners out: the bad response could be saved in a transient, so the error kept coming back even after the remote service was fixed.

Manual recovery steps from the WooCommerce notice

  1. Clear the ptk_patterns transient with WP-CLI: wp transient delete ptk_patterns.
  2. No WP-CLI? Delete the _transient_ptk_patterns row from the wp_options table (adjust the table prefix to match your database).
  3. If that does not work, add a guard to the parse_categories() function in BlockPatterns.php that returns an empty array when categories are missing or not an array.
  4. Update to WooCommerce 9.8.4 or later.

Some owners used a one-line stopgap instead, adding ?? '' on line 251 so a null title becomes an empty string:

if (strpos($category['title'] ?? '', $prefix) !== false) {

Treat that as a bridge to the official update, not a permanent edit. Core plugin files are overwritten on the next update.

Hosts with layered caching added a wrinkle. In the Search Engine Journal report, one WP Engine customer needed support to clear several cache layers, including the page cache and Varnish, before the site recovered.


Why Errors Like This Reach Live Stores

A null in a data feed is a small mistake. Here is why small mistakes become outages on WordPress.

1. Plugins now depend on remote services

This crash did not come from a new line of code on your server. It came from data fetched from an outside service. Any plugin that pulls patterns, templates, licence checks or catalogues from a remote API inherits that API’s bad days.

2. A huge extension surface

WooCommerce integrates with shipping APIs, payment gateways, subscription handlers, marketing tools, custom post types and blocks. Every integration point is a place where an unexpected value can arrive.

3. Missing defensive checks

Functions such as strpos() need predictable inputs. Without a type check or a fallback, a single unexpected null can stop an entire request.

4. Updates and data refreshes that nobody watches

Automatic plugin updates are convenient, and they also mean a problem can reach thousands of sites before anyone is awake to react. The same goes for remote data refreshes that run on a schedule.


How to Protect Your WooCommerce Store

One honest note first: a staging site would not necessarily have caught this specific bug, because the bad input came from a remote service at a particular moment. What limits the damage from this kind of incident is fast detection and fast recovery. Staging still matters for the many failures that do come from updates.

1. Set up a staging environment

Test updates, checkout flows and plugin compatibility on a copy of your store before touching production.

  • Use a tool such as WP Staging or your host’s staging feature.
  • Run a full purchase, a refund and a coupon test.
  • Push to production only after the checks pass.

2. Control auto-updates for WooCommerce

WordPress lets you switch off auto-updates per plugin on the Plugins screen. You can also enforce it in code with a site-specific plugin:

add_filter( 'auto_update_plugin', function( $update, $item ) {
    if ( $item->slug === 'woocommerce' ) return false;
    return $update;
}, 10, 2 );

If you disable auto-updates, schedule a weekly slot to review and apply them by hand, otherwise you trade one risk for a security one.

3. Keep off-site backups with a tested restore

Run daily backups, and more often if you take many orders per hour. Back up files, the database, WooCommerce orders and custom settings, and store copies off-site. Tools such as UpdraftPlus, BlogVault and Jetpack Backup cover this. A backup you have never restored is a guess, so run a restore drill once a quarter.

4. Monitor uptime and log errors

Uptime monitors such as UptimeRobot, Pingdom or Better Stack alert you when the site stops responding. Pair them with error logging that stays out of the visitor’s view:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Check /wp-content/debug.log for fatal errors. On a live store, turn WP_DEBUG back off once you have what you need.

5. Write defensive code in your own customisations

If you write custom WooCommerce code, validate types and use fallbacks:

$title = $category['title'] ?? '';
if (is_string($title) && strpos($title, $prefix) !== false) {
    // logic
}

6. Pin plugin versions in Composer workflows

If you manage WordPress with Composer, pin the plugin version so deployments are repeatable, and update only after staging passes:

"wpackagist-plugin/woocommerce": "9.8.4"

7. Follow the official channels


If Your Store Is Down Right Now

1. Reach the files by SFTP or your host’s file manager

Open /wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php and apply the null guard shown above, or go straight to step 2.

2. Disable WooCommerce temporarily

If you cannot edit code quickly, rename the /woocommerce/ plugin folder to /woocommerce-disabled/. That restores access to the admin so you can update the plugin, then rename the folder back.

3. Clear the cached pattern data

Delete the ptk_patterns transient as described above, then clear every cache layer: plugin cache, object cache, host cache and your CDN.

4. Understand why a rollback may not help

Because the bad data came from a remote service, rolling WooCommerce back to an older version did not recover every site. The Search Engine Journal report quotes one commenter whose rollback failed. Updating to a patched release and clearing the transient is the better path.


Building Resilience Beyond One Bug

  • Automate tests for checkout with WP-CLI, PHPUnit or an end-to-end tool such as Cypress.
  • Put updates behind an approval step.
  • Review error logs and deprecation notices on a schedule.
  • Keep a developer or agency on call for stores with steady revenue. Our custom ecommerce development guide covers what to ask for.
  • Read the plugin vendor licence-risk checklist so your other dependencies do not surprise you either.

Summary Checklist for Site Owners

Task What to do
Backups Daily off-site backups of files and database, restore tested quarterly
Staging Mirror the live store for update testing
Auto-update control Review WooCommerce updates before they go live
Uptime monitoring Alert on downtime within minutes
Official notices Follow the WooCommerce developer blog and GitHub
Plugin audit Remove unused or abandoned plugins
Recovery runbook Write down who clears caches, who restores backups and who calls the host

Frequently asked questions

What caused the WooCommerce fatal error in May 2025?

WooCommerce received incorrect block pattern data from its remote pattern service. A null category title then reached strpos() in BlockPatterns.php, and PHP stopped the request. The WooCommerce developer blog describes the cause as a remote service failure.

Which WooCommerce version fixed it?

WooCommerce 9.8.4, released on 6 May 2025, added a guard so the error is not triggered when categories is null. If the error persists after updating, clear the ptk_patterns transient.

How do I clear the ptk_patterns transient?

Run wp transient delete ptk_patterns with WP-CLI. Without WP-CLI, delete the _transient_ptk_patterns row from the wp_options table, using your own table prefix.

Would a staging site have prevented the crash?

Not reliably. The bad data came from a remote service, not from a plugin update you could test first. Fast monitoring, off-site backups and a written recovery runbook are what shorten this kind of outage.

Should I turn off WooCommerce auto-updates?

It depends on how closely you watch the store. If you turn them off, review updates weekly so security fixes do not wait. Stores with steady order volume usually test updates on staging first.

Shashank Dubey
Content & Marketing, Wbcom Designs

Shashank Dubey, a contributor of Wbcom Designs is a blogger and a digital marketer. He writes articles associated with different niches such as WordPress, SEO, Marketing, CMS, Web Design, and Development, and many more.

Related reading