modifying the product ratings block
-
Hi Wocommerce. I’m designing my front page and I’ve inserted a product ratings block on three sample products below the slider on the front page. However I am having trouble styling it. The ratings stars show twice in a row, and the number of reviews text shows beside it. There is no way to rearrange this or remove the repeated stars.
I’m not sure if it is because I have a php snippet that allows number of reviews to show beside stars, but it meant only for the shop page, not for blocks, the code is below.
/**
- Display the number of reviews on the shop page.
*/
function custom_display_product_reviews() {
global $product; if ( $product && $product->get_id() ) {
$reviews_count = $product->get_review_count();if ( $reviews_count > 0 ) { echo '<div class="custom-reviews-count">'; echo '<span class="review-count">(' . $reviews_count . ' ' . _n( 'review', 'reviews', $reviews_count, 'your-text-domain' ) . ')</span>'; echo '</div>'; }
}
}
add_action( ‘woocommerce_after_shop_loop_item_title’, ‘custom_display_product_reviews’, 5 );
add_action( ‘wpcp_after_product_rating_woocommerce’, ‘custom_display_product_reviews’, 5 );For the record, i’ve tried disabling this and nothing changes on the ratings block. Also this function doesn’t seem to work anymore for some reason. It used to 10 months ago. Please advise as well. Thanks!
The page I need help with: [log in to see the link]
- Display the number of reviews on the shop page.
- You must be logged in to reply to this topic.