Support

Account

Home Forums General Issues ACF Taxonomy images in product pages

Unread

ACF Taxonomy images in product pages

  • I’m struggling to populate ACF product_tag taxonomy images into product pages. Each product may be assigned to 1 or more product tag. I’d like to display those images and make the link to their archive pages.

    ACF Screenshot
    Product tag Screenshot

    I have this code but it is only showing the word “Tag”. Can’t make it pull the images:

    add_action('woocommerce_before_add_to_cart_form','finish_image',22);
    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->term_id);
    print_r($image);
    echo 'Tag <img src="'.$image.'" alt="" />';
    }
    }
    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.