is_user_verified(); $confirm_flag = intval($_POST['confirm-order-flag']); if ($confirm_flag == "1" && !$user_verified) { wc_add_notice( __( "custom_notice", 'fake_error' ), 'error'); } $status = sanitize_text_field($_POST['user-status']); if ($status && ($status == 'av_success' || $status == 'av_failed')) { $user_id = $user_ctrl->get_authorized_user(); $status = sanitize_text_field($_POST['user-status']); $user_ctrl->update_user_status($user_id, $status); } } add_action('woocommerce_after_checkout_validation', 'add_fake_error'); // Update user and order status if validation popup placed on thank you page function thankyou_status_update() { $status = sanitize_text_field($_POST['user_status']); $order_id = intval($_POST['order_id']); if ($status && ($status == 'av_success' || $status == 'av_failed')) { $user_ctrl = new UserController(); $user_id = $user_ctrl->get_authorized_user(); $user_ctrl->update_user_status($user_id, $status); } if ($order_id) { $order_ctrl = new OrderController(); $order_ctrl->update_order_status($order_id); } wp_die(); } add_action('wp_ajax_nopriv_thankyou_status_update', 'thankyou_status_update'); add_action('wp_ajax_thankyou_status_update', 'thankyou_status_update');