Custom order status for orders paid using wallet credit?
-
Hello, I need to change the order status for orders that were purchased using wallet credit. I made a new custom order status called ‘Payment received’ using this code:
function add_payment_received_to_order_statuses( $order_statuses ) { $new_order_statuses = array(); foreach ( $order_statuses as $key => $status ) { $new_order_statuses[ $key ] = $status; if ( 'wc-on-hold' === $key ) { $new_order_statuses['wc-payment-received'] = 'Payment received'; } } return $new_order_statuses; } add_action( 'init', 'register_payment_received_order_status' ); add_filter( 'wc_order_statuses', 'add_payment_received_to_order_statuses' );
I tried to follow this thread to change the order status but it did not seem to change anything, I still had to manually go into the order page and then change the order status. This was the code that I used:
add_action('woo_wallet_payment_processed', 'woo_wallet_payment_processed_callback'); if(!function_exists('woo_wallet_payment_processed_callback')){ function woo_wallet_payment_processed_callback($order_id){ $order = wc_get_order($order_id); $order->set_status('Payment received'); $order->save(); } }
Other than that, I also tried to do so using this code:
add_filter( 'woocommerce_wallet_process_payment_order_status', 'change_wallet_order_status', 9999, 2 ); function change_wallet_order_status( $status, $order ) { return 'Payment received'; }
But similarly to the previous one, this didn’t seem to do anything. Any advice?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom order status for orders paid using wallet credit?’ is closed to new replies.