user_email); if (isset($_POST['id']) && !empty($_POST['id'])) { $id = htmlspecialchars(strip_tags(trim(sanitize_text_field($_POST['id'])))); } if (isset($id)) { $commentdata = array( 'comment_post_ID' => $id, 'comment_author' => '', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => "Paid and ready for Aramex shipment", 'comment_type' => 'order_note', 'user_id' => "0", ); wp_new_comment($commentdata); $order = new WC_Order($id); $order->add_order_note($commentdata['comment_content']); $order->save(); if (!empty($order)) { $order->update_status("wc-processing_aramex", ""); } $response['success'] = true; header('Content-type: application/json'); echo json_encode($response); die(); } else { die("not correct data"); } } } $optilogPaid = new Optilog_Paid();