Listing only parent categories in woocommerce

$args = array(
‘orderby’    => ‘title’,
‘order’      => ‘ASC’,
);
$product_cats= get_terms( ‘product_cat’, $args );
foreach ( $product_cats as $product_category ) {
if($product_category->parent == 0) {

// code

}

}