Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you only insert it, it will be overridden by the original code. You would have to replace it. No time now but can have a look at what you need to replace exactly and how it would work for all attributes

    Hi

    I think, that is a woocommerce issue that they don’t show the description. I altered the product-attributes.php in templates/single-product (woocommerce) to show the description (for a specific attribute only: pa_garn), starting at line 54:

    if ( $attribute['is_taxonomy'] ) {
    // changes persillie
    //$values = woocommerce_get_product_terms( $product->id, $attribute['name'], 'names' );
       $values = array();
       $separator = ',';
       // here I check the specific attribute
       if ('pa_specAttr' == $attribute['name']){
        $separator = '<br>';
        $garns = get_the_terms($product->id, 'pa_specAttr');
    
        foreach ( $garns as $term )   {
          $text = $term->name .": ".$term->description;
          $values[$term->name ] = $text ;
        }
      } else {
        $values = woocommerce_get_product_terms( $product->id,
            $attribute['name'], 'names' );
      }
      echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( $separator, $values ) ) ), $attribute, $values );
      // end changes persillie
    } else {
      // Convert pipes to commas and display values
      $values = array_map( 'trim', explode( WC_DELIMITER,
                $attribute['value'] ) );
      echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
    
    }

    If you want it for every attribute, remove the if below the // here I check the specific attribute comment

    However, this is annoying as I have to change the template with every woocommerce update…

    I am very happy if anybody has a better solution!

Viewing 2 replies - 1 through 2 (of 2 total)