• Resolved friedhelm

    (@friedhelm)


    Fatal error: Uncaught Error: Call to undefined method WP_Post::get_id() in /www/htdocs/w020d330/kyudopfeile.de/wp-content/plugins/woocommerce-delivery-notes/includes/admin/class-backend.php:190 Stack trace: #0 /www/htdocs/w020d330/kyudopfeile.de/wp-admin/includes/template.php(1453): Tyche\WCDN\Backend->create_box_content(Object(WP_Post), Array) #1 /www/htdocs/w020d330/kyudopfeile.de/wp-admin/edit-form-advanced.php(714): do_meta_boxes(Object(WP_Screen), ‘side’, Object(WP_Post)) #2 /www/htdocs/w020d330/kyudopfeile.de/wp-admin/post.php(206): require(‘/www/htdocs/w02…’) #3 {main} thrown in /www/htdocs/w020d330/kyudopfeile.de/wp-content/plugins/woocommerce-delivery-notes/includes/admin/class-backend.php on line 190

    after update to 7.01 i have this error,
    orders are not editable any more, please help

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter friedhelm

    (@friedhelm)

    //print_r( $post );

    //$order_id = ( $post instanceof WP_Post ) ? $post->ID : $post->get_id();

    $order_id = ( $post instanceof WP_Post ) ? $post->ID : wc_get_order( $post->ID );

    i changed this in class-backend.php, now its working…

    jaswinder657

    (@jaswinder657)

    Hi @friedhelm

    I am facing the same issue. It does show the Printing buttons again after applying your fix above, but on click it gives error, Invalid order. Do you also get the same error ?

    jaswinder657

    (@jaswinder657)

    I managed to fix Invalid order by replacing your line of code with –

    if ( $post instanceof WP_Post ) {
    $order_id = $post->ID;
    } elseif ( is_object($post) && method_exists($post, ‘get_id’) ) {
    $order_id = $post->get_id();
    } else {
    $order_id = isset($post->ID) ? $post->ID : 0;
    }

    if ( ! $order_id ) {
    return;
    }

    kender

    (@kender)

    a more complete fix here (redundancies and checks added)

    Replace the beginning of create_box_content() with:

    public function create_box_content( $post ) {
    	$order = null;
    
    	if ( $post instanceof WC_Order ) {
    		$order = $post;
    	} elseif ( $post instanceof WP_Post ) {
    		$order = wc_get_order( $post->ID );
    	} elseif ( is_numeric( $post ) ) {
    		$order = wc_get_order( absint( $post ) );
    	}
    
    	if ( ! $order instanceof WC_Order || $order instanceof WC_Order_Refund ) {
    		return;
    	}
    
    	$order_id = $order->get_id();

    Steve

    (@thewebsmiths)

    Version 7.0.2 has been released and resolves this issue.

    Plugin Support anjitha21

    (@anjitha21)

    Hi @friedhelm @thewebsmiths @kender @jaswinder657,

    We sincerely apologize for the inconvenience caused and appreciate your patience while this was being resolved.

    Version 7.0.2 has now been released, which resolves the issues you experienced.

    Please update the plugin to the latest version and check at your end.

    If you face any further issues or need assistance, please feel free to reach out.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.