skip to Main Content

I’m getting this error on WooCommerce:

An error has occurred while processing recent subscription related events. For steps on how to fix the affected subscriptions and to learn more about the possible causes of this error, please read our guide here.

On the logs, it read like this:

scheduled action 10528608 (subscription payment) failed to finish processing due to the following exception: The script tried to modify a property on an incomplete object. Please ensure that the class definition "StripePrice" of the object you are trying to operate on was loaded before unserialize() gets called or provide an autoloader to load the class definition in /wordpress/core/6.6/wp-includes/formatting.php:5137

The WooCommerce subscription was not being processed and failed due to a WP Core formatting issue.

Also, this all started after an upgrade from PHP 7.4 to PHP 8.3

2

Answers


  1. Chosen as BEST ANSWER

    To fix the problem, I had to import the missing library that formatting.php was complaining about.

    I created a small plugin that all it does is:

    <?php
    /**
     * Plugin Name: Stripe PHP Loader
     * Version: 1.0.0
    */
    
    require_once plugin_dir_path(__FILE__) . 'stripe-php/init.php';
    

    Make sure to download the latest release of stripe-php and put that library in your plugin directory.

    After activating the plugin, try to manually renew one of the Subscriptions. To do this:

    1. Change the Subscription from On Hold to Active and click Update
    2. From the Subscription actions right panel, choose Process renewal and click Update again

    That should be it. Ideally, you should also change the status of the previous order to Cancelled, to keep it clean. You can find that Order ID in the WooCommerce Logs under WooCommerce > Status > Logs


  2. I totally get your frustration with the Woo Subscription error. It sounds like the issue stems from how PHP 8.3 handles object serialization, especially with the Stripe class. Since upgrading from PHP 7.4, these kinds of compatibility hiccups can pop up. The key here is to ensure the Stripe class is loaded before unserialize() is called, which might involve tweaking your autoloader settings. I recently read an article on Cloudways that dives deep into such issues and provides some neat solutions. You might find it really helpful. Check it out and hopefully, it’ll help you resolve this!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search