如果有人需要的话
$args = array(
\'type\' => \'product\',
\'parent\' => get_queried_object_id(),
\'orderby\' => \'term_group\',
\'hide_empty\' => true,
\'hierarchical\' => 1,
\'taxonomy\' => \'product_cat\',
\'pad_counts\' => false
);
$cats = get_categories( $args );
print_r(count($cats));