Public Ticket #3424007

Order status after approval

Closed
Comments
6 Tickets 6
Min Tran started the conversation 3 years ago on July 27, 2023 at 7:47am

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 (b2bkingplugin.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!

2,762
KingsPlugins replied 3 years ago on July 27, 2023 at 1:23pm

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

Sign In