Answer the question
In order to leave comments, you need to log in
How to get tags of a specific product in wordpress with woocommerce framework?
The essence of the question is as follows: in the product card, I need to display the link I need in the products with a certain tag.
Accordingly, I wrote a condition under which the link should be displayed, but I can’t get an array from the tags of the current product.
Here are a couple of stackoverflow examples:
<?php /* if( $product->get_tags( $product ) == "тег") ?><a href="/link/">link text</a>
<?php endif; */ ?>
<?php /*
$terms = get_terms( 'product_tag' );
$term_array = array();
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$term_array[] = $term->name;
}
}
if(in_array('оплата мастер-класса',$term_array)) {
echo 'found';
} else {
echo 'not found';
} */ ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question