WooCommerce fatal error: Immediate action required

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 the parse_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:

  1. We’ve deployed a temporary API fix that returns empty category arrays instead of null values
  2. 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.


9 responses to “WooCommerce fatal error: Immediate action required”

  1. Daniel Spain Avatar
    Daniel Spain

    Hi, if searching the db table wp_options for any value with option_name = _transient_ptk_patterns doesn’t retrieve anything are we safe? I didn’t experience any trouble yet, i’m asking just in case…thanks!

    1. Nadir Seghir Avatar
      Nadir Seghir

      Yes, only follow the steps if you’re seeing the error. If you didn’t see the error you’re safe to go. As this only affects a subset of sites that tried to update in the 1h timeframe of when this bug happend.

  2. Abdalsalaam Halawa Avatar
    Abdalsalaam Halawa

    Thanks! we were debugging our code to check what is going on 😀

  3. i am getting same error

    An error of type E_ERROR was caused in line 251 of the file /home/forge/gos-testing.tantra-gyan.com/public/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php. Error message: Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, null given in /home/forge/gos-testing.tantra-gyan.com/public/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php:251 Stack trace: #0 /home/forge/gos-testing.tantra-gyan.com/public/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(251): strpos() #1 [internal function]: AutomatticWooCommerceBlocksBlockPatterns->AutomatticWooCommerceBlocks{closure}() #2 /home/forge/gos-testing.tantra-gyan.com/public/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(260): array_map() #3 [internal function]: AutomatticWooCommerceBlocksBlockPatterns->AutomatticWooCommerceBlocks{closure}() #4 /home/forge/gos-testing.tantra-gyan.com/public/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(247): array_map() #5 /home/forge/gos-testing.tantra-gyan.com/public/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(229): AutomatticWooCommerceBlocksBlockPatterns->parse_categories() #6 /home/forge/gos-testing.tantra-gyan.com/public/wp-includes/class-wp-hook.php(324): AutomatticWooCommerceBlocksBlockPatterns->register_ptk_patterns() #7 /home/forge/gos-testing.tantra-gyan.com/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #8 /home/forge/gos-testing.tantra-gyan.com/public/wp-includes/plugin.php(517): WP_Hook->do_action() #9 /home/forge/gos-testing.tantra-gyan.com/public/wp-settings.php(727): do_action() #10 /home/forge/gos-testing.tantra-gyan.com/public/wp-config.php(87): require_once(‘…’) #11 /home/forge/gos-testing.tantra-gyan.com/public/wp-load.php(50): require_once(‘…’) #12 /home/forge/gos-testing.tantra-gyan.com/public/wp-login.php(12): require(‘…’) #13 {main} thrown

    1. Hi Satyam,

      That error indeed indicates that you should clear your transients and upgrade to the latest version of WooCommerce.

  4. Yes, it worked, thank you for good guidance

  5. Aleksandar Avatar
    Aleksandar

    During the staging creation we got this error:
    PHP Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, array callback must have exactly two members in /mnt/customers/customers-bh-32ax7p/13a0d40b-bbf2-413d-8f6e-6c8b9d4e977b/wp-content/wp-includes/rest-api/class-wp-rest-server.php:1628

    we could not create staging until we disabled WooCommerce plugins.
    I think it may be useful to understand if this bug affects rest API also. In our case it does.

    1. Hi Aleksander,

      I reached out to some of the engineers who worked on the fix for this issue, and they’ve confirmed that ptk_patterns doesn’t call internal REST API endpoints, so it’s unlikely that your issue is related.

      It is possible that you have some other plugin conflicts that have caused this error, however. Were you able to re-enable the WooCommerce plugin after creating your staging site?

  6. Aleksandar Avatar
    Aleksandar

    Yes. I was being able to activate it without any issue. Prior to that patterns and all other transient was cleared. I am mention this because i tried several combinations and this one worked.
    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *