With this code, you can display a product attribute in the template, for example, “size”.
global $product; echo $product->get_attribute('size');
Below I publish a method for displaying a property with an additional icon output, if this property is filled in:
<?php $subheadingvalues = get_the_terms( $product->id, 'pa_time'); if ($subheadingvalues): ?> <div class="labeltime"><i class="fa fa-clock-o" aria-hidden="true"></i> <?php foreach ( $subheadingvalues as $subheadingvalue ): echo $subheadingvalue->name; echo '</div>'; endforeach; endif; ?>
In this example, time is an attribute slug.