'Not able to get get_term_link in product-attributes.php woocommerce
I have the below code:
<?php
$terms = get_the_terms( $post->ID, 'product_cat');
foreach ($terms as $term ) {
$product_cat_name .= $term->name . ', ';
}
?>
<tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--<?php echo esc_attr( $product_attribute_key ); ?>">
<th class="woocommerce-product-attributes-item__label"><?php esc_html_e( 'Category', 'webinweb'); ?></th>
<td class="woocommerce-product-attributes-item__value" ><?php echo '<a href="'.get_term_link($term->slug, $term->taxonomy).'">'.$product_cat_name.'</a>'; ?> </td>
<tr>
The link to each product-category is set by 'get_term_slug'. But this is always the same product-category link and not the product-category link for that product.
What do I need to add to get this working?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
