How to create a Child & Siblings menu for a custom post type?

OK, I think I have cracked it. The below code seems to work well. To be able to use a custom post type I added an argument into the $args array'post_type' => 'product',

Is the below OK?

      <div id="sub-pages">
        <?php
        global $post;
        $args = array(
          'post_type' => 'product',
          'child_of' => get_top_ancestor_id(),
          'title_li' => ''
        );
        $the_query = new WP_Query($args);
        ?>
        <ul>
          <?php wp_list_pages($args); ?>
        </ul>
        <?php wp_reset_postdata(); ?>
      </div>
// Get top ancestor
function get_top_ancestor_id() {

    global $post;

    if ($post->post_parent) {
        $ancestors = array_reverse(get_post_ancestors($post->ID));
        return $ancestors[0];
    }

    return $post->ID;

}