Support

Account

Home Forums General Issues Display value of attribute from ACF field group

Solving

Display value of attribute from ACF field group

  • Hi

    I have setup an ACF field group with multiple fields (Text and Taxonomy). I want to show the value of a field in the product (WooCommerce).

    With the text fields, it works like this:
    get_field('myfield')

    But with the taxonomy fields, I just get the ID of the attribute.

    How can I display the value set in the product on this attribute instead of the ID?

  • Solved:

    <?php 
    $term_id = get_field('myfield');
    $term_name = get_term( $term_id )->name;
    echo "<b>" . $term_name . "</b><br>";
    ?>  
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.