• Resolved Pavlo Kr.

    (@pavlok)


    When I try to sync orders I get an error:
    ERROR order_submit.error :: addStoreOrder :: #3695275 :: Error Code 400 ::
    id: cannot be empty
    on 2438 in wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-api.php


    The problem is in line items:
    [lines] => Array
    (
    [0] => Array
    (
    [id] => 0
    [product_id] => 18853
    [product_variant_id] => 18853
    [quantity] => 1
    [price] => 404.33
    )

    The id of line item can’t be “0”

    To solve this error I edited the file
    wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php
    And on line 188 I replaced
    $item?=?$this->transformLineItem(?$key,?$order_detail?);
    with
    $lineItemKey = $key + 1;
    $item = $this->transformLineItem( $lineItemKey, $order_detail );

    • This topic was modified 1 year, 6 months ago by Pavlo Kr..
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support khungate

    (@khungate)

    Hello @pavlok, I’ve noticed the issue you’re facing and I think you’ve pinpointed the problem correctly where the id of a line item cannot be zero during orders synchronization. Your manual adjustment to the class-mailchimp-woocommerce-transform-orders-wc3.php file is a good temporary fix.

    To address this, you can also incorporate the following code snippet:

    function modify_line_item_key($key, $order) {

    $key = $key + 1;

    return $key;

    }

    add_filter('mailchimp_line_item_key', 'modify_line_item_key', 10, 2);


    This will effectively increment the line item key, similar to your manual adjustment.

    Also, we are planning to include a fix for this issue in our next plugin update to prevent this problem from occurring in the future.

    We appreciate your communication on this matter, and thank you for bringing this to our attention!

    Plugin Support khungate

    (@khungate)

    Hi @pavlok, 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, that 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 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Orders synchronization error – id: cannot be empty’ is closed to new replies.