• fluff

    (@fluffmedisera)


    Currently running WordPress 6.6.2 with Woocommerce 9.3.3 on PHP 5.8 and also tested with PHP 7.3. I suspect that this error has been with this installation for a long while. Basically the following is being logged with the debug log once per request:

    Cron unschedule event error for hook: woocommerce_plugin_background_installer, Error code: could_not_set, 
    Error message: The cron event list could not be saved., 
    Data: {"schedule":false,"args":["stripe",{"name":"Stripe","image":"http:\/\/domain.name\/wp-content\/plugins\/woocommerce\/assets\/images\/stripe.png","description":"**REDACTED**","class":"featured featured-row-first","repo-slug":"woocommerce-gateway-stripe"}]}
    

    I’ve tried using the wp CLI to remove the event and also edited the cron entry in wp_optionsdatabase table but this entry in the cron keeps coming back.

    As I’ve inherited this installation, I don’t know if the Stripe plugin has been installed at some point but it’s not installed at the moment even though I’ve installed and removed it just to see if it would solve the issue, but it did not.

    wp cron event list gives the following output:

    +----------------------------------------------+---------------------+-----------------------+---------------+
    | hook | next_run_gmt | next_run_relative | recurrence |
    +----------------------------------------------+---------------------+-----------------------+---------------+
    | woocommerce_plugin_background_installer | 2017-05-12 09:11:09 | now | Non-repeating |

    Any ideas how I get rid of this error?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Mahfuzur Rahman(woo-hc)

    (@mahfuzurwp)

    Hi @fluffmedisera,

    To resolve this issue, please start by ensuring that any residual cron jobs are cleared from your database. Check the wp_options table for any references to the woocommerce_plugin_background_installer cron job and remove them. You can also use the following code snippet in your functions.php file to ensure the cron job is cleared:

    if ( ! wp_next_scheduled( 'woocommerce_plugin_background_installer' ) ) {
    wp_clear_scheduled_hook( 'woocommerce_plugin_background_installer' );
    }

    Additionally, check for any leftover Stripe plugin files in the wp-content/plugins folder, as remnants might be causing the issue. If you’ve deactivated all plugins except WooCommerce and the problem persists, try updating your PHP version to at least 7.4, as older versions may cause issues with certain functions.

    Finally, review your WooCommerce logs for any related errors and clear the cron job using WP-CLI if necessary. If the problem continues, you might need to contact your hosting provider to check for server-level cron job issues.

    Thread Starter fluff

    (@fluffmedisera)

    Hello @mahfuzurwp and thank you for the reply.

    I have checked the wp_options table and it’s only referenced in the cron-entry. As stated before, it does not help if I remove the entry from the serialized data – it gets inserted again.

    If I enable the if-statement you provided the error message goes away, but it returns as soon as I remove the if-statement. Now that may very well be what you intended for me to do.

    However I must ask if there’s a potential problem disabling the background installer permanently via this if-statement. Ie will there be a risk of something else that’s supposed to be run via this “background installer” not getting run at all?

    I am currently testing with PHP 7.4.33 and the error persists unless the if-statement is in place.

    I’ve also reviewed all plugins and disabled all plugins, all the way up to including woocommerce without the error going away.

    This error message is the only one connected to anything cron, background or stripe.

    This is also a VPS installation, we have full control over the environment and we have tested with both all cronjobs disabled and with our “normal” cronjobs enabled. No difference, the error message persists.

    So the TL;DR question: While it’s not a very elegant solution, can I keep the code permanently in my codebase without risking other jobs/events not being run when the woocommerce_plugin_background_installer-hook is cleared each run?

    Again, thank you for the response and help so far.

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello fluff,

    Thank you for your reply.

    I understand that you’ve thoroughly investigated this issue and found that disabling the background installer via the if-statement prevents the error. Your main concern is whether keeping this fix permanently could interfere with other necessary background tasks.

    You are right about this, disabling the background installer might cause more problems.
    You mentioned that you inherited this site, does that mean this site was developed and maintained by someone else before you?

    To investigate this further, I want to understand your site configuration.
    Please share your site’s System Status Report with me.
    You can paste it into https://pastebin.com and share the link here.

    Looking forward to your response. ??

    Thread Starter fluff

    (@fluffmedisera)

    Hi,

    Yes, you are correct in that someone else has made the original install and development on this site.

    I have extracted the system status report here.

    Password for paste: qE9Wex8qPx

    And paste is here: https://pastebin.com/axigBrBc

    Thank you for the reply!

    Plugin Support LovingBro (woo-hc)

    (@lovingbro)

    Hi @fluffmedisera,

    Thanks for sharing your system status report. The error you’re seeing is caused by WooCommerce trying to run a background installer for the Stripe extension, a task that’s left over from a previous installation even though the Stripe plugin isn’t active.

    To stop this error, please add the following code to your theme’s functions.php file or a custom plugin:

    add_filter( 'woocommerce_background_installer_disabled', '__return_true' );

    This tells WooCommerce not to attempt the background installation, which should clear the error from your logs.

    I also noticed that your WooCommerce templates and core software (WordPress and WooCommerce) are a bit outdated. Your site is currently running WordPress 6.6.2, while version 6.7.2 is available. Similarly, you’re using WooCommerce 9.3.3, with 9.6.2 ready for update. Upgrading to these latest releases can enhance compatibility, performance, and security. This update might also help resolve other underlying issues on your site.

    You might also want to review your scheduled cron jobs using a tool like WP Crontrol. Removing orphaned or outdated cron entries can help keep your system clean and reduce unnecessary error logging.

    If you have any more questions, feel free to ask.

    Thread Starter fluff

    (@fluffmedisera)

    Hi,

    Thank you for the reply.

    I note that the following code:
    add_filter( 'woocommerce_background_installer_disabled', '__return_true' );

    does not eliminate the error message in my error logs. What is the difference between this code and the previous recommended code? And why can’t I just remove the rest of the Stripe plugin installation since I’m not using it?

    I am aware that we’re not on the latest version due to plugin dependencies that at the moment prevents me from upgrading further.

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello fluff,

    Thank you for your reply.

    I am aware that we’re not on the latest version due to plugin dependencies that at the moment prevents me from upgrading further.

    According to our support policy, it is important to update the WordPress, themes and plugins to the latest version. This is to make sure there are no issues due to outdated code.

    I understand you have plugins that are dependent on the current version.
    In that case, I suggest you create a staging site and check whether updating the WordPress and plugins resolves the issue.

    Let me know how it goes.

    Best regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.