• Resolved cosmoweb

    (@cosmoweb)


    Hi,

    i found this fatal error maybe when order is completed:

    PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function MailChimp_Service::handleOrderUpdate(), 1 passed in /var/www/vhosts/mywebsite.com/httpdocs/wp-includes/class-wp-hook.php on line 308 and exactly 2 expected in /var/www/vhosts/mywebsite.com/httpdocs/wp-content/plugins/mailchimp-for-woocommerce/includes/class-mailchimp-woocommerce-service.php:511
    Stack trace:

    0 /var/www/vhosts/mywebsite.com/httpdocs/wp-includes/class-wp-hook.php(308): MailChimp_Service->handleOrderUpdate()

    1 /var/www/vhosts/mywebsite.com/httpdocs/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()

    2 /var/www/vhosts/mywebsite.com/httpdocs/wp-includes/plugin.php(517): WP_Hook->do_action()

    3 /var/www/vhosts/mywebsite.com/httpdocs/wp-content/plugins/woocommerce/includes/legacy/api/v2/class-wc-api-orders.php(629): do_action()

    4 /var/www/vhosts/mywebsite.com/httpdocs/wp-content/plugins/woocommerce/includes/legacy/api/v2/class-wc-api-server.php(371): WC_API_Orders->edit_order()

    5 /var/www/vhosts/mywebsite.com/httpdocs/wp-content/plugins/woocommerce/inc in /var/www/vhosts/mywebsite.com/httpdocs/wp-content/plugins/mailchimp-for-woocommerce/includes/class-mailchimp-woocommerce-service.php on line 511

Viewing 5 replies - 1 through 5 (of 5 total)
  • I encountered the same issue on one of my sites starting about last Friday, 2023-07-17. Looking through WooCommerce, it seems that they might be triggering a legacy version of the woocommerce_update_order action which excludes the 2nd parameter, $order. This is definitely not ideal, but the temporary fix I’ve done is to edit includes/class-mailchimp-woocommerce-service.php to not require the $order parameter as such:

    public function handleOrderUpdate($order_id, $order = null) { // Default $order to null
        if (is_null($order)) $order = new \WC_Order($order_id); // If $order is null, create from provided $order_id
        mailchimp_log('handleOrderUpdate', 'order_status');
        $this->handleOrderSaved($order_id, $order, true);
    }

    I did the same for handleOrderCreate as well just in case. It would definitely be better to have a permanent fix for this in the next update of this plugin.

    Thread Starter cosmoweb

    (@cosmoweb)

    @ogrecooper thank you so much, tomorrow i’ll be if work.

    I wait updated version, thank you so much again

    Can confrim for now editing the $order = null resolves the error.

    Plugin Support khungate

    (@khungate)

    Thanks for reporting @cosmoweb @dennispeachy @ogrecooper, we will be issuing a patch for this error in v3.1 coming out very soon.

    Plugin Support khungate

    (@khungate)

    Hi @cosmoweb, @dennispeachy, @ogrecooper version 3.1 has been released and should fix this bug. Please let us know if you need help with anything else, we appreciate your patience while we worked through things.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Mailchimp For Woocommerce Fatal error’ is closed to new replies.