You don't have permission to view this order."; return; } $order = wc_get_order($order_id); if ( !$order ) { return; } $delivery_process = Wiaas_Delivery_Process::get_order_delivery_process_entry($order->get_id()); if ($delivery_process && wp_verify_nonce($_POST['wiaas_delivery_process_navigation_nonce'], 'wiaas_delivery_process_navigation') && GFAPI::current_user_can_any( 'manage_wiaas_order_delivery_process' )) { self::_maybe_process_admin_step_change_action($delivery_process); // refresh order $order = wc_get_order($order_id); } require 'views/html-admin-delivery-process-page.php'; } private static function _maybe_process_admin_step_change_action($entry) { $admin_action = rgpost( 'wiaas_delivery_process_navigation_action' ); if ($admin_action === 'complete') { $api = new Gravity_Flow_API( $entry['form_id'] ); $current_step = $api->get_current_step($entry); if ( $current_step ) { $current_step->purge_assignees(); $current_step->update_step_status( 'complete' ); } $api->process_workflow($entry['id']); } list( $base_admin_action, $action_id ) = rgexplode( '|', $admin_action, 2 ); if ( $base_admin_action == 'send_to_step' ) { $step_id = $action_id; $api = new Gravity_Flow_API( $entry['form_id'] ); $api->send_to_step( $entry, $step_id ); } } } Wiaas_Admin_Order_Process_Flow::init();