• Resolved michaelcartersa

    (@michaelcartersa)


    Busy debugging why my system doesn’t sync and I came across this error:

    
    PHP Fatal error:  Uncaught Error: Call to undefined method WC_Order::get_date_created() in /path/to/site/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders.php:69
    Stack trace:
    #0 /path/to/site/wp-content/plugins/mailchimp-for-woocommerce/includes/processes/class-mailchimp-woocommerce-single-order.php(84): MailChimp_WooCommerce_Transform_Orders->transform(Object(WP_Post))
    #1 /path/to/site/wp-content/plugins/mailchimp-for-woocommerce/includes/processes/class-mailchimp-woocommerce-single-order.php(40): MailChimp_WooCommerce_Single_Order->process()
    #2 /path/to/site/wp-content/plugins/mailchimp-for-woocommerce/includes/vendor/queue/classes/worker/wp-worker.php(57): MailChimp_WooCommerce_Single_Order->handle()
    #3 /path/to/site/wp-content/plugins/mailchimp-for-woocommerce/includes/vendor/queue/classes/cli/queue-command.php(92): WP_Worker->process_next_job()
    #4 [internal function]: Queue_Command->work(Array, Array)
    #5 phar:/ in /path/to/site/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders.php on line 69
    

    So it seems like you are trying to use get_date_created, a function that doesn’t exist anymore. I also noticed that get_date_modified gets called later in the file and that doesn’t exist either.

    Untested but I rate something like this might work:

    
    // change this
    $order->setProcessedAt($woo->get_date_created()->setTimezone(new \DateTimeZone('UTC')));
    // to this
    $order->setProcessedAt((\new DateTime($woo->order_date))->setTimezone(new \DateTimeZone('UTC')));
    
    // change this
    $order->setCancelledAt($woo->get_date_modified()->setTimezone(new \DateTimeZone('UTC')));
    // to this
    $order->setCancelledAt((\new DateTime($woo->modified_date))->setTimezone(new \DateTimeZone('UTC')));
    

    I’m using WooCommerce 2.6.14.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @michaelcartersa,

    Thanks for reaching out! I’m sorry to hear about the issue you’re running into with our plugin. Thank you so much for providing us with such detailed information and logging. That being said, WooCommerce recently released a few newer versions, and v 3.0 specifically brought along some major changes that may affect functionality. To rule that out, would you mind first ensuring that you’re using the latest version of MailChimp for WooCommerce (2.0.1) and then updating your WooCommerce plugin to their latest version to see if the issue persists? If it does, could you please reply back here with any errors you see logged on your end after updating? Thank you! After that has been done I’ll be sure to pass all of this information along to our developers who will dig in further. We really appreciate it – feel free to post any other related questions as you run into them.

    Thanks again!

    Pearl

    Thread Starter michaelcartersa

    (@michaelcartersa)

    Hi

    Thanks, you have a very good point. I checked and your code works on v3. Unfortunately though, due to a large amount of plugins that we depend on we can’t update to version 3 yet, but I’m busy patching it myself now to get it to work on WooCommerce 2.6.

    I think the last issue is a continuous spawning of a MailChimp_WooCommerce_Process_Orders process. My queue table had about 3000, I deleted all of them and now there are 300 already. Any idea what could be causing this?

    Hey @michaelcartersa,

    Thanks again! I apologize for the delay on my end. I went ahead and escalated this issue and passed all of this information along to our developers who agree that this is odd behavior that should be addressed. Unfortunately I won’t be able to provide an estimated time frame for resolution, but this is being looked into. In the meantime, I’ll be updating this post if our developers request additional information or as this issue is resolved.

    Thanks again!

    Pearl

    • This reply was modified 7 years, 2 months ago by mcsupport.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Uncaught Error: Call to undefined method WC_Order::get_date_created()’ is closed to new replies.