Support » Plugin: Mailchimp for WooCommerce » Fatal Error when connecting an account

  • Resolved Dan

    (@danrwalker)


    When connecting Mailchimp plugin to my mailchimp account, I enter my details in the popup window, I go back to the plugin settings page and get the message “Connection in progress”. This message never goes away, the AJAX request in the background failes with a PHP fatal error:

    [24-Feb-2021 13:51:54 UTC] PHP Fatal error:  Uncaught Error: Cannot use object of type WP_Error as array in /www/wp-content/plugins/mailchimp-for-woocommerce/admin/class-mailchimp-woocommerce-admin.php:729
    Stack trace:
    #0 /www/wp-includes/class-wp-hook.php(287): MailChimp_WooCommerce_Admin->mailchimp_woocommerce_ajax_oauth_finish('')
    #1 /www/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
    #2 /www/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    #3 /www/wp-admin/admin-ajax.php(184): do_action('wp_ajax_mailchi...')
    #4 {main}
      thrown in /www/wp-content/plugins/mailchimp-for-woocommerce/admin/class-mailchimp-woocommerce-admin.php on line 729

    I am running WP 5.6.1, WooCommerce 4.9.1 and MailChimp plugin 2.5.0

    I have tried this process both with and without WooCommerce Admin plugin installed and active. Any help/advice would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Dan

    (@danrwalker)

    I made a quick update to the plugin file mailchimp-for-woocommerce/admin/class-mailchimp-woocommerce-admin.php on line 729, I added detection for WP_Error so I could see what message was coming back from the remote call.

     $response = wp_remote_post( 'https://woocommerce.mailchimpapp.com/api/finish', $pload);
            if (!is_wp_error($response) && $response['response']['code'] == 200 ){
    			delete_site_transient('mailchimp-woocommerce-oauth-secret');
                // save api_key? If yes, we can skip api key validation for validatePostApiKey();
                wp_send_json_success($response);
            }
            else wp_send_json_error( $response );

    I get back the following response now in the AJAX, not sure if this is helpful towards diagnosing the issue?

    {"success":false,"data":[{"code":"http_request_failed","message":"Too many redirects"}]}

    Plugin Author ryanhungate

    (@ryanhungate)

    @danrwalker we haven’t been able to replicate this exact issue – and my first question would be “are you using a shared hosting provider?” This can be a sign of Mailchimp’s API gateway blocking the request from your server. If you’re on a shared host, or if you could simply try this override setting – this test and this change may resolve that error altogether. Can we start with that?

    Plugin Support khungate

    (@khungate)

    Hi @danrwalker, we’re going to close out this ticket for now since it’s been a few weeks since we’ve been in touch.

    Please let us know if you still need any help and we’ll be glad to reopen and troubleshoot further. Please note, the best way to reach us is over at the GitHub plugin page: https://github.com/mailchimp/mc-woocommerce/. From there, you can receive direct responses from the development team, log new issues, download the latest version, and track existing support tickets.

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