Update:
On May 6, 2025, WooCommerce 9.8.4 was released with a targeted fix for this issue. Read more.
The details
Some WooCommerce stores are experiencing fatal errors. This issue relates to how WooCommerce was receiving incorrect block pattern data from our remote service providing the patterns.
How can I tell if this affects me?
If your store admin panel or store frontend are displaying Uncaught Error: strpos(): Argument #1 ($haystack) must be of type string, null given
or you’re unable to access your store or admin area completely, you may be impacted by this issue.
What action should I take?
If your store is experiencing this issue, there are several things you can do to fix it while our fix propagates to all sites (we have deployed a fix, but it will take some time to reach all sites).
- If possible, clear the
ptk_patterns
transient, which can be done with WP CLI:wp transient delete ptk_patterns --skip-themes --skip-plugins
- Directly delete _transient_ptk_patterns from the DB (update the
wp_
prefix to your db prefix)DELETE FROM wp_options WHERE option_name = '_transient_ptk_patterns';
- If you are unable to use the previous methods, modify the
plugins/woocommerce/src/Blocks/BlockPatterns.php
file and add this code block inside of theparse_categories()
function:
/**
* Parse prefixed categories from the PTK patterns into the actual WooCommerce categories.
*
* @param array $patterns The patterns to parse.
* @return array The parsed patterns.
*/
private function parse_categories( array $patterns ) {
if ( ! isset( $patterns['categories'] ) || ! is_array( $patterns['categories'] ) ) {
return array();
}
⚠️ We recommend that all affected stores clear their transients with one of the above methods to ensure that your stores do not cache incorrect _transient_ptk_pattern.
What we are doing
Our team is actively addressing this with two approaches:
- We’ve deployed a temporary API fix that returns empty category arrays instead of
null
values - The technical team is working on fixing the URL references in our pattern source site
We’re prioritizing this issue and will provide updates to this post and our socials as we confirm the fix is working correctly across all affected stores. We apologize for this disruption and are working to restore normal service as quickly as possible.
Leave a Reply