/** * Completes order * * @access public * @param int $ID * @return void */ public static function completeOrder($ID) { $relations = ThemexWoo::getRelatedPost($ID, array('course_product', 'plan_product')); if (!empty($relations)) { foreach ($relations as $related) { if ($related->post_type == 'course') { ThemexCourse::addUser($related->ID, $related->post_author, true); } else { if ($related->post_type == 'plan') { ThemexCourse::subscribeUser($related->ID, $related->post_author, true); } } } } }