Support » Plugin: Mailchimp for WooCommerce » Errors filling logs

  • Resolved Jacob Peattie



    We’re currently seeing a few errors from this plugin filling up our logs. It would be great if the issue could be resolved to stop these warnings:

    PHP Warning: Invalid argument supplied for foreach() in .../public_html/wp-content/plugins/mailchimp-for-woocommerce/bootstrap.php on line 251

    I found a topic with a similar message here:

    We haven’t experienced any issues with the plugin’s functionality, but even if the issue was that our server is “being blacklisted by the API gateway”, that’s not something that should throw a PHP warning. The plugin should be checking that the value is correct before using foreach(), if there’s a possibility that it’s not.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ryanhungate


    @jakept this seems to be related to the API returning a NULL response. After checking into this method, we’re actually going to not only fix the type check but we’ll also optimize this so it’s not calling the API so often. Stay tuned for 2.3.4 release – it’s already in active development, but there’s no guarantee on this release date just yet.

    For now, if you needed to update the plugin for this to silence itself, we can just simply wrap it like this:

    $stores = $api->stores();
    if (!empty($stores)) {
        //iterate thru stores, find correct store ID and save it to db
        foreach ($stores as $mc_store) {
            if ($mc_store->getDomain() === get_option('siteurl')) {
                update_option('mailchimp-woocommerce-store_id', $mc_store->getId(), 'yes');
                $store_id = $mc_store->getId();

    Thanks for bringing this one up – the API is supposed to return an array there and it’s probably returning NULL for some reason. We’ll get this fixed up 🙂

    • This reply was modified 1 year, 2 months ago by ryanhungate.
    Thread Starter Jacob Peattie


    I looked closer and it turns out the plugin wasn’t functioning after all, the client just hadn’t reported a problem. I think my point about the error still stands though, but it sounds like you’re on top of it, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Errors filling logs’ is closed to new replies.