get_terms parent for current product only

get_terms relates to getting all the terms of a taxonomy. get_the_terms grabs all the terms related to the post.

The problem is that it sounds like you only want to return those terms which are parent categories, not the children, and get_the_terms does not pass an arguments array.

$terms = get_the_terms( get_the_ID(), 'product_cat' );

foreach ( $terms as $term ){
    if ( $term->parent == 0 ) {
        echo '<div class="parent '.$term->slug.'">' . $term->name . '</div>';
    }
}

error code: 523