Change cash on delivery order status to pending payment
-
I understand how to update order status via function.php for cash on delivery payments from processing to pending payment. The code for that is below:
function QuadLayers_change_order_status( $order_id ) { if ( ! $order_id ) {return;} $order = wc_get_order( $order_id ); if( 'processing'== $order->get_status() ) { $order->update_status( 'wc-pending-payment' ); } } add_action('woocommerce_thankyou','QuadLayers_change_order_status');
What I am looking for is to override WooCommerce default status whenever a customer checksout for the first action to trigger is Pending Payment. With that edited code above it’s the second action, as it only changes all orders from Processing when form is submitted to Pending Payment.
I need this change because I am using a wallet balance to checkout for digital items. Customers are using cash on delivery payment method with P2P app Venmo/Cash App/Zelle to add a balance to their wallet. With the above code customers do not have to send me any payment for their wallet balance to increase because WooCommerce default nature is to mark all orders as Processing once checkout form is submitted. This is why I need for the default action (not a redirection) to be Pending Payment. That way once I can physically see for myself that the customer sent me the money via P2P app, I can then approve their order which in return will show their new wallet balance.
- The topic ‘Change cash on delivery order status to pending payment’ is closed to new replies.