Uncaught Error: Call to undefined method WC_Order::get_date_created()
-
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 thatget_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)
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.