Answer the question
In order to leave comments, you need to log in
How can I make the product rating in the store catalog (wooCommerce) according to the condition I set?
How can I make the product rating in the store catalog (wooCommerce) according to the condition I set?
The condition is if there are products on the page without a rating (stars), then do not display the rating (stars) on those products on which they are!? this is not an easy question! Maybe someone already did it?
Answer the question
In order to leave comments, you need to log in
function wpp_disable_empty_rating_in_archive( $html, $rating, $count ) {
if ( ( is_shop() || is_product_category() || is_product_tag() ) && empty( $rating ) ) {
return '';
} else {
return $html;
}
}
add_filter( 'woocommerce_product_get_rating_html', 'wpp_disable_empty_rating_in_archive', 10, 3 );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question