php - ACF Taxonomy images in product pages

Solution:

Add term id as second parameter and use global $product, then try if you get image url

    add_action('woocommerce_before_add_to_cart_form','finish_image');
function finish_image() {
global $product;
$terms = get_the_terms( $product->get_id() , 'product_tag' );
if($terms) {
foreach( $terms as $term ) {
$image = get_field('tag-image', $term);
$url = get_term_link($term->term_id);
echo '<a href="'.$url.'"><img src="'.$image.'" alt="" style="width: 100px; border: none; margin-right: 30px;"/></a>';
}
}
}

Answer

Solution:

For whoever needs it, here is the final code thanks to @DrashtiRajpura

add_action('woocommerce_before_add_to_cart_form','finish_image');
function finish_image() {
global $product;
$terms = get_the_terms( $product->get_id() , 'product_tag' );
if($terms) {
foreach( $terms as $term ) {
$image = get_field('tag-image', $term);
$url = get_term_link($term->term_id);
echo '<a href="'.$url.'"><img src="'.$image.'" alt="" style="width: 100px; border: none; margin-right: 30px;"/></a>';
}
}
}

Source