• Hi there,
    I am using a plugin with the following code in its admin page. It appears to be compatible with Sequential Order Number, but it keeps throwing errors. Does this code look appropriate?:

        function column_order_id($item) {
    
            $order_id = get_post_meta( $item->ID, '_order_id', true );
            $order = wc_get_order( $order_id );
            $order_number = ( $order ) ? $order->get_order_number() : '-';
    
            if ( class_exists('WC_Seq_Order_Number') ) {
                $seq_order_id = $GLOBALS['wc_seq_order_number']->find_order_by_order_number( $order_id );
    
                if ( $seq_order_id ) {
                    return '<a href="post.php?post='. $order_id .'&action=edit">#'. $seq_order_id .'</a>';
                } else {
                    return '<a href="post.php?post='. $order_id .'&action=edit">'. $order_number .'</a>';
                }
            } else {
                return '<a href="post.php?post='. $order_id .'&action=edit">'. $order_number .'</a>';
            }
        }
    

    The error is:

    Fatal error: Uncaught Error: Call to a member function find_order_by_order_number() on null in
    /htdocs/wp-content/plugins/woocommerce-plugin/includes/class.plugin_active_reports_list_table.php:101
    

    Thank you

  • The topic ‘Plugin not getting the right order number, crashing admin page’ is closed to new replies.