You can use below code:
$args = array(
\'type\' => \'product\',
\'child_of\' => 0,
\'parent\' => \'\',
\'orderby\' => \'term_group\',
\'hide_empty\' => false,
\'hierarchical\' => 1,
\'exclude\' => \'\',
\'include\' => \'\',
\'number\' => \'\',
\'taxonomy\' => \'product_cat\',
\'pad_counts\' => false
);
$cats = get_categories( $args );