Hello i have this code which adds a custom status called refund issued to the order status
function register_awaiting_shipment_order_status() {
register_post_status( 'wc-awaiting-shipment', array(
'label' => 'Return',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Return <span class="count">(%s)</span>', 'Return <span class="count">(%s)</span>' )
) );
register_post_status( 'wc-refund-issued', array(
'label' => 'Refund Issued',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Refund Issued<span class="count">(%s)</span>', 'Refund Issued <span class="count">(%s)</span>' )
) );
}
add_action( 'init', 'register_awaiting_shipment_order_status' );
// Add to list of WC Order statuses
function add_awaiting_shipment_to_order_statuses( $order_statuses ) {
$new_order_statuses = array();
// add new order status after processing
foreach ( $order_statuses as $key => $status ) {
$new_order_statuses[ $key ] = $status;
if ( 'wc-processing' === $key ) {
$new_order_statuses['wc-awaiting-shipment'] = 'Return';
$new_order_statuses['wc-refund-issued'] = 'Refund Issued';
}
}
return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_awaiting_shipment_to_order_statuses' );
i want to be able to change the custom order status through
$order->status_update('refund issued');
but it doens't work it only work for the status that already comes with woocommerce like processing and pending payment when i run the code it changes the status to payment pending instead of refund issued what am i doing wrong ? in the end what im trying to accomplish is to make a refund button in the view order area so the user can issue a refund request to the current order