I am using custom Purchase Order based payment gateway method in Woocommerce and have registered my custom status status – Pending PO Verification for all orders made using this payment method. The issue is i am getting Payment Pending message on admin and customer my account-> Order page attached screenshot for the same. admin order status screenshot and customer my account->Order page screenshot . My custom order status code below:
// WooCommerce order page status add Pending PO Verification //
// 1. Register custom order status
function register_pending_po_verification_order_status() {
register_post_status( 'wc-pending-po-verification', array(
'label' => 'Pending PO Verification',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => nnoop( 'Pending PO Verification (%s)', 'Pending PO Verification (%s)' )
));
}
add_action( 'init', 'register_pending_po_verification_order_status' );
// 2. Add to WooCommerce order status list
function add_pending_po_verification_to_order_statuses( $order_statuses ) {
$new_order_statuses = array();
// Insert after 'wc-pending'
foreach ( $order_statuses as $key => $status ) {
$new_order_statuses[ $key ] = $status;
if ( 'wc-pending' === $key ) {
$new_order_statuses['wc-pending-po-verification'] = 'Pending PO Verification';
}
}
return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_pending_po_verification_to_order_statuses' );
Attached is the link https://posterika.com/op.html of my custom Purchase Order Gateway
I have tried everything to make it work but the order status isnot changing to Pending PO Verification.
Looking forward to your help.
Thanks
I have tried all the combination like renaming the order status, hooks to change the order status but it is not working. I want you to advise me where is the issue in my code. Request a solution where the order status changes to Pending PO Verification after placing the order using Purchase Order Gateway.