Okay
  Public Ticket #3424007
Order status after approval
Closed

Comments

  •  6
    Min Tran started the conversation

    I need that after an order of a subaccount is approved, its status will become "Processing" in steads of "Pending Payment" because our business policy is payment on delivery.

    According to your documentation. It's only set to Pending Payment.

    Company Order Approval - B2BKing (woocommerce-b2b-plugin.com)

    I've tried this code snippet but it does not work:

    add_action( 'woocommerce_order_status_pending', 'changing_order_status_after_approval', 10, 3 );
    function changing_order_status_after_approval( $order_id, $posted_data, $order ){
        $order->update_status( 'processing' );
    }

    Please help.

    Thank you!

    Attached files:  Untitled121212.png

  •  2,285
    WebWizards replied

    Hi Min,

    You can add this PHP code snippet to your site:

    add_action('b2bking_after_approve_order', function($order){
           $order->update_status( 'processing', esc_html__( 'Order approved.', 'b2bking' ) );
           $order->save();
    }, 10, 1);
    

    It should set the order to "processing" after it's approved.


    Let me know if you have any issues with that,

    Kind regards,

    Stefan

  •  6
    Min Tran replied

    It works excellently as I expect.

    Thank you so much, Stefan.