Rating in product page

Hi,

We have used below code in our child theme. We found this code on Themeco’s Forum

remove_action( 'woocommerce_single_product_summary', 
'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 
'my_woocommerce_template_single_rating', 10 );
function my_woocommerce_template_single_rating() {
global $product;
if ( $product->post->comment_status === 'open' )
    wc_get_template( 'single-product/rating.php' );
return true;
}

With above code we are able to show star rating in the single product page that has been reviewed (Rated) by customer. The issue is that the rating’s link is not working (The link doesn’t scroll to the review tabs section of the product page). You can see the issue via below link.

https://www.hamroshringar.com/product/pax-moly-dr-jk1-sun-screen-lotion-face-body-200-ml/

Also we want to show this rating and link to every product page even if the product is not reviewed or rated by the customers.

Hoping for the response.

Thank you and best regards.
Bibhash Karn

Hey Bibhash Karn,

Please refer to these old threads:

Note: We are unable to provide support for customizations under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One or Care service for further assistance.

Thank you for your understanding.

Hi,

Thank you for your response and links provided. Sorry to say but none of the link help us to achieve the things that we are looking for. We just want the active the review tab when user click the link ( (customer ratings (Customer Reviews) ) as in the below link.

https://www.hamroshringar.com/product/pax-moly-dr-jk1-sun-screen-lotion-face-body-200-ml/

Also we want to show this rating and link to every product page even if the product is not reviewed or rated by the customers.

Hoping for the solution.

Thank You.

Hi Bibhash,

I think the reordering of the tabs will solve your issue, in that case, the Review tab will be the activated tab and the link to the Review tab will work as you are expecting. Please add the following code into your child theme’s functions.php.

add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {

    $tabs['reviews']['priority'] = 5;			// Reviews first
    $tabs['description']['priority'] = 10;			// Description second
    $tabs['additional_information']['priority'] = 15;	// Additional information third

    return $tabs;
}

Please go through the following article to know more on the tabs, https://docs.woocommerce.com/document/editing-product-data-tabs

Please remember that the above or example code in the given link will work if copied as it is and don’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide custom codes that mean we can’t fix it if it conflicts with something on your site nor will we enhance it.

If you don’t want to reorder the tabs, you may need some custom development to achieve this and which is beyond the scope of theme support. I would suggest you hire a developer who can assist you to do the customization or as my colleague suggested you can avail of our newly launched service called One, where the customization questions are answered.

And the Review tab always shows even if there is no review is available for that Product.

Thanks

Hello,

Thank you for the response and the suggested code. Thank you for the suggestion.

We will look around on how can we achieve the link to review tab as suggested. Thank you.

And we are not looking for Review Tab. It is already shown in every products but we are looking for the Review Link beneath the price of the products even if there is no review available for the product.

Thank you.

Hi Bibhash,

Glad that we are able to help you with this. Regarding the Review Link, that only comes when a product has any review. You can add any custom links by using the predefined WooCommerce hooks for the Single Product page.
Please find the hooks in the following article.

Please remember that we don’t offer any support or investigation on custom codes or related issues.

Hope it helps.
Thanks

Hello,

Thank you for response and the link. Thank you for your kind support.

Thank you and best regards.

Hello Bibhash,

Glad that we were able to help you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.