I am trying to get the featured image of the "Primary" selected category of a product.
Getting the images from the categories is not the problem, but how do I get the "primary" one?
Currently this is what I am using and of course getting all the images.
I only want to display one image.
<?php
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ){
$category_thumbnail = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true);
$image = wp_get_attachment_url($category_thumbnail);
echo '<img src="'.$image.'" alt="" />';
}?>