Ordering terms whilst in loop

I just realised

I already have the parent from here $category = $_GET[‘category’];

So I changed my code:

<td class="custom-cat"> <span class="term">
<?php echo $category; ?>
</span></td>

<td class="custom-sub-cat"> <span class="term">
<?php
$terms = get_the_terms( get_the_ID(), 'custom-category' );

  foreach ( $terms as $term ){
  if ( $term->parent ==! 0 ) {
    echo $term->name;
  }

}
 ?>
</span></td>

As I only have one parent and one child for each taxonomy the above works fine for me as a work around.