new WC_Order(); Coming Back Empty

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

0

Leave a Comment