Home › Forums › WoodMart support forum › Only product page empty stars
Only product page empty stars
- This topic has 9 replies, 2 voices, and was last updated 8 months, 2 weeks ago by Aizaz Imtiaz Awan.
-
AuthorPosts
-
March 30, 2024 at 1:02 am #553467
smart.sharukhkhan786ParticipantHi,
1. I would like to display empty stars on the single product pages that I’ve created using Elementor.
2. I’ve attempted numerous PHP codes, but none seem to work because I’m utilizing an Elementor widget provided by your theme, as depicted in the attached image.
3. Additionally, next to the stars, it currently displays “(1 customer review)”. I would prefer it to show just “(1)” and remove “customer review”.
4. If possible, I would like to customize the text for products with no reviews. Instead of showing stars, it should display the text “Write a review”. Clicking on this should scroll the page to the review section.
Currently, only the “(1 customer review)” text is clickable and scrolls to the rating section. I would like the stars (including the number of reviews) to be clickable and perform the same action.
Attachments:
You must be logged in to view attached files.March 30, 2024 at 1:46 pm #553542
Aizaz Imtiaz AwanKeymasterHello,
01 & 02. You need to add some reviews for the products to display star ratings. If you want to show an empty rating of a single product you need to use some php code. Try to add the following code in the function.php of the child theme.
add_action('woocommerce_single_product_summary', 'change_single_product_ratings', 2 ); function change_single_product_ratings(){ remove_action('woocommerce_single_product_summary','woocommerce_template_single_rating', 10 ); add_action('woocommerce_single_product_summary','wc_single_product_ratings', 10 ); } function wc_single_product_ratings(){ global $product; $rating_count = $product->get_rating_count(); if ( $rating_count >= 0 ) { $review_count = $product->get_review_count(); $average = $product->get_average_rating(); $count_html = '<div class="count-rating">' . array_sum($product->get_rating_counts()) . '</div>'; ?> <div class="woocommerce-product-rating"> <div class="container-rating"><div class="star-rating"> <?php echo wc_get_rating_html( $average, $rating_count ); ?> </div><?php echo $count_html ; ?> <?php if ( comments_open() ) : ?><a href="#reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'woocommerce' ), '<span class="count">' . esc_html( $review_count ) . '</span>' ); ?>)</a><?php endif ?> </div></div> <?php } }
03. Please add below Custom CSS code to Theme Settings > Custom CSS > Global custom CSS for remove “customer review”.
.woocommerce-review-link { display: none; }
04. Could you please elaborate on your concern more with some useful Screenshots so that we can better understand and assist you accordingly
Best Regards.
March 30, 2024 at 2:32 pm #553548
smart.sharukhkhan786ParticipantHi,
Thank you so much for your reply.
1 & 2: I have added the codes, but I still see nothing. You can also try it yourself by going to Dashboard > Snippets > All Snippets and adding a new one.
3: I have added the code, but I’m unsure what this CSS is for. I can still see “1 customer review.”
4: My query (1&2) relates to the issue of empty stars. In today’s world, nobody likes to see empty stars, it erodes customer trust. Seeing five empty stars can be off-putting, but if there’s a text saying “write a review” (only for products with 0 reviews), it can be helpful for verified customers. They can easily open the product page and see the “write a review” text. By clicking on it, they will be scrolled down to the review section.
If a product has any number of reviews, it should display stars and indicate how many people have reviewed the product, like this:
***** (1)
Attachments:
You must be logged in to view attached files.March 30, 2024 at 3:02 pm #553563
Aizaz Imtiaz AwanKeymasterHello,
You need to find a third party plugin to achieve more functionality that best suits you. We have not tested such kinds of plugins, so we don’t have any detailed suggestions
https://www.cloudways.com/blog/review-plugins-for-woocommerce/
Best Regards.
March 30, 2024 at 3:13 pm #553564
smart.sharukhkhan786ParticipantHi,
I don’t want more, 4th query is optional.
I just want to show empty stars, I added your codes, and not working, please test by yourself. and thank you for your suggestion. But I’m worried about compatibility with your theme, We can talk later about this, right now I want to show empty stars
April 1, 2024 at 9:23 am #553750
Aizaz Imtiaz AwanKeymasterHello,
Sorry to say it requires customization and beyond our support policy. Additional code customizations are out of our theme support scope.
Hope you can understand!
Best Regards.
April 2, 2024 at 9:44 pm #554353
smart.sharukhkhan786ParticipantHi, I found something very interesting.
I’ve been searching for custom codes to display empty stars on the product page. Recently, I was exploring all the settings within the theme. I navigated to Theme Settings > Product Archive > Product Settings, where I found an option labeled “Show empty star rating”. Now, I can see empty stars on the product archives. However, I want them to appear on the product page, but no codes seem to work.
Note: I’m not using woocommerce element to show empty stars on my product page. It’s an elementor element by your theme. That’s why no custom codes working.
Attachments:
You must be logged in to view attached files.April 3, 2024 at 11:33 am #554498
Aizaz Imtiaz AwanKeymasterHello,
Try to add a rating widget in the layout with the help of elementor. It will show the empty star rating on your site.
https://ibb.co/5TW6X2WBest Regards.
April 3, 2024 at 12:51 pm #554547
smart.sharukhkhan786ParticipantHi, If I enable that, I will have to enable Theme Settings > Performance > Plugin > Elementor frontend right?
April 3, 2024 at 3:22 pm #554606
Aizaz Imtiaz AwanKeymasterHello,
You can use this widget without enabling this option. You can use this option “Elementor frontend” in Woodmart to optimize performance by turning off Elementor’s JavaScript files if you’re not using many of their widgets. This helps your site load faster.
Best Regards.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register