I'm currently using Change Related Products Heading adding the product name in WooCommerce answer code but instead of the get_the_title I want to be getting the tags of the product
$term_list = array();
$terms_data = wp_get_post_terms( get_the_id(), 'product_tag' );
if( count($terms_data) > 0 ){
foreach($terms_data as $termdata){
$term_id = $termdata->term_id;
$term_name = $termdata->name;
$term_slug = $termdata->slug;
$term_link = get_term_link( $termdata, 'product_tag' );
$term_list[] = '<a href="'.$term_link.'">'.$term_name.'</a>';
}
$term_list = implode( ', ', $output );
echo $term_list;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.