• Resolved khalil43

    (@khalil43)


    Hi, after the order is completed, some customers access to the old link of order confirmation ( /checkout/order-received/…ey=wc_order_JtZSQ7hItRjZp) and this change the order status from completed to processing. please help thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter khalil43

    (@khalil43)

    i think this function is responsible, please what should i modify to avoid this problem

    add_action( 'woocommerce_thankyou', 'cheque_payment_method_order_status_to_processing', 10, 1 );
    function cheque_payment_method_order_status_to_processing( $order_id ) {
        if ( ! $order_id )
            return;
    
        $order = wc_get_order( $order_id );
    
        // Updating order status to processing for orders delivered with Cheque payment methods.
        if (  get_post_meta($order->id, '_payment_method', true) == 'cheque' )
            $order->update_status( 'processing' );
    }
    • This reply was modified 3 years, 7 months ago by khalil43.
    Thread Starter khalil43

    (@khalil43)

    Solved by using this code instead of the first

    //change order status cheque to processing
      add_action( 'woocommerce_thankyou', 'cheque_payment_method_order_status_to_processing', 10, 1 );
    function cheque_payment_method_order_status_to_processing( $order_id ) {
        if ( ! $order_id )
            return;
    
        $order = wc_get_order( $order_id );
    
        // Updating order status to processing for orders delivered with Cheque payment methods.
      global $product;
    $order = wc_get_order( $order_id );
        if ($order->data['status'] == 'on-hold')
    	{if (  get_post_meta($order->id, '_payment_method', true) == 'cheque' )
            $order->update_status( 'processing' );
    }}

    please tell me if there is any mistake thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Customers change order status from completed to processing’ is closed to new replies.