• Resolved facturaone

    (@facturaone)


    I am trying to access the detail of an order via array with:

    $order = new WC_Order($order_id);
    print_r($order)

    But it returns the error:
    Fatal error: Uncaught Exception: Invalid Order. in /var/www/vhosts/tbai.facturaone.com/httpdocs/wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:104

    Looking inside the file I see inside line abstract-wc-order-data-store-cpt.php:104:

    if ( ! $order->get_id() || ! $post_object || ! in_array( $post_object->post_type, wc_get_order_types(), true ) ) {

    wc_get_order_types() is an empty array, and never compare with a “shop_order”

    thanks for your valuable help ??

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘new WC_Order() -> Fatal error: Uncaught Exception: Invalid Order’ is closed to new replies.