function zendesk_update_order($order_id) { $orders = new WC_Order($order_id); $items = $orders->get_items(); $set_plan = false; $plan = ''; if (!empty($items)) { foreach ($items as $item) { $product_variation_id = $item['variation_id']; if ($product_variation_id == 2400) { $plan = 'Starter'; $set_plan = true; break; } elseif ($product_variation_id == 2401) { $plan = 'Standard'; $set_plan = true; break; } elseif ($product_variation_id == 2402) { $plan = 'Platinum'; $set_plan = true; break; } else { //THIS ORDER HAS NO ITEMS WITH PACKAGE PLAN $plan = ''; } } if ($set_plan == true) { //STORE PURCHASED PACKAGE PLAN FOR FUTURE REFERENCE update_post_meta($order_id, 'Plan', $plan); //START PROCESSING ZENDESK REQUESTS zendesk_process_user($order_id); } } }
<?php echo zendesk_process_user($_GET['order_id']);