2

I'm trying to use new WC_Order( $order_id ); to pull in info from orders to send to an API and the call comes back empty.

I have also tried using wc_get_order( $order_id ); and I have confirmed that the $order_id is valid and returning what I would expect. I also looked around and can't find any input into why this call is coming back empty. Any ideas would be welcome!

Relevant code starts around line 300.

public function process_order($order_id) {
    // if ( !$this->api_ready() ) return false;
    $order = new WC_Order( $order_id );
    $items = $order->get_items();
    update_post_meta($order_id, 'woo_pd_order_orderid', $order);

link to repo: https://github.com/deganhart/Printdropper-for-WooCommerce/blob/master/printdropper-for-woocommerce.php#L303

1
  • wc_get_order() is the new new WC_Order(). but your problem might be, that woocommerce isn't even initiated?
    – honk31
    Commented Feb 15, 2017 at 15:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.