Ready to get started?Download WordPress


WooCommerce - excelling eCommerce
How to show selected Attribute Term Description on Product Page? (2 posts)

  1. hollyann22
    Posted 1 year ago #

    Searched high and low with no resolution. Seems its been awhile since it's been asked so maybe there is a solution now.

    How can I get the description for an attribute's term to show when selected?(a variation that has been selected on the product page - in my case I would like to show the description for the scent that has been selected from the dropdown).

    I did find this code and inserted it into the variable.php file:

    <?php $my_taxonomy = 'pa_scents';
    $terms = wp_get_post_terms( $post->ID, $my_taxonomy );
    echo term_description($terms[0]->term_id, $my_taxonomy); ?>

    It is the closest I've come but will only return the description for the first item in the terms list, no matter what is chosen.

    I tried radio buttons but that took up too much room.

    Any ideas?

    Thank you so very much! (I am using Whitelight if that matters)


  2. valoros
    Posted 10 months ago #

    Did you find a solution for this? I'm using the following - but I want "pa_arsenalho" to be a variable. I've tried 'taxonomy' and $taxonomy but neither work.

    $customepattributes = get_the_terms( $product->id, 'pa_arsenalho');
          foreach ( $customepattributes as $customepattributes ) {
              echo "<b>".$customepattributes->name."</b>";
              echo $customepattributes->description;

    I need the code in the template to display whatever the taxonomy is linked to the page

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic