Hi, WP Discuz
I am not sure from when, but the comments count (of woocommerce) is changed to Zero when the new comment is added.
Could you help me to check how to fix it..
Thank you,
Best regards,
Hi @jjk100479
Please follow the steps below:
- Navigate to Dashboard > wpDiscuz > Forms admin page
- Edit the current form
- Edit the Rating field you've created
- Find and click on the "Advanced Options" link
- Fill "rating" as a value of the "Meta Key" field.
time to end of this ....... problem in public
I Hope WPDiscuz Fix This Bug in New Plugin Update.
ways for do that
We Can Fix Review Count For WooCommerce With Changing
$review_count = $product->get_review_count();
esc_html( $review_count ) or echo $review_count
To
$post_id = get_the_ID();
$review_count = wp_count_comments( $post_id );
echo $review_count->total_comments;
in any where of your theme or in the woocommerce plugin templates
this is done.sample is here....
1
Fix Review Count in Review Tab(Title)
go to your theme directory :
wp-content/themes/YOUR-THEME-NAME/woocommerce/single-product/tabs/tabs.php
and add this commands to first of your code :
add_filter( 'woocommerce_product_tabs', 'misha_rename_additional_info_tab' );
function misha_rename_additional_info_tab( $tabs ) {
$post_id = get_the_ID();
$review_count = wp_count_comments( $post_id );
$tabs['reviews']['title'] = ' Revieeeeews '.'('. $review_count->total_comments.')' ;
return $tabs;
}
this is easy way for rename tabs,we use of this point for our target.
tab renamed but i add little change for counter comments too.
2
Fix Rating file
go to your theme directory :
wp-content/themes/YOUR-THEME-NAME/woocommerce/single-product/rating.php
and update your code like this sample :
<?php
/**
* Single Product Rating
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/rating.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.6.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $product;
if ( ! wc_review_ratings_enabled() ) {
return;
}
$post_id = get_the_ID();
$review_count = wp_count_comments( $post_id );
$rating_count = $product->get_rating_count();
$average = $product->get_average_rating();
$review_link = apply_filters('gon_woocommerce_review_link_filter', '#comments');
$comments_count = wp_count_comments( $post->ID );
if ( esc_html($comments_count->approved)-1 > 1 ) : ?>
<div class="woocommerce-product-rating">
<?php echo wc_get_rating_html( $average, $rating_count ); ?>
<?php if ( comments_open() ) : ?>
<a href="<?php echo esc_url($review_link); ?>" class="woocommerce-review-link" rel="nofollow">
<span class="count"> Reviews(<?php echo $review_count->total_comments; ?>) </span></a><?php endif ?>
</div>
<?php else: ?>
<div class="woocommerce-product-rating">
<?php if ( comments_open() ) : ?>
<a href="<?php echo esc_url($review_link); ?>" class="woocommerce-review-link" rel="nofollow">
<?php esc_html_e( 'Write your comment', 'gon' ); ?></a><?php endif; ?>
</div>
<?php endif; ?>
Updates :
$review_count = $product->get_review_count();
esc_html( $review_count ) or echo $review_count
To
$post_id = get_the_ID();
$review_count = wp_count_comments( $post_id );
echo $review_count->total_comments;
3
you can fix this problem directly in woocommerce plugin too(template dir)
if anyone need to more guide for doing this way say to me in comments or mail to me :
hacker.s2h@gmail.com
I will explain later.I'm not bored right now 😐
Good NEWS : Ioncube Decoder v10 PHP 7.2 Public Soon in There :