Answer the question
In order to leave comments, you need to log in
How to make woocomerce tag tile?
Hello everyone, how can I create a product tag tile in the woocomerce store category. You need to display only those tags whose products are shown in the category. For example, in the category "soft toys" only tags of products that are on this page are shown.
I'll be back for any advice
Answer the question
In order to leave comments, you need to log in
$current_tags = get_the_terms( get_the_ID(), 'product_tag' );
//only start if we have some tags
if ( $current_tags && ! is_wp_error( $current_tags ) ) {
//create a list to hold our tags
echo '<ul class="product_tags">';
//for each tag we create a list item
foreach ($current_tags as $tag) {
$tag_title = $tag->name; // tag name
$tag_link = get_term_link( $tag );// tag archive link
echo '<li><a href="'.$tag_link.'">'.$tag_title.'</a></li>';
}
echo '</ul>';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question