• Resolved free14

    (@free14)


    My new products change in size if there are no stars. In goods with stars the size of the frame is larger. How do I turn on an empty star?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter free14

    (@free14)

    I found a top where the client solves this issue.https://www.ads-software.com/support/topic/make-review-stars-visible-always/ . But it’s a crutch. Because when you upgrade the plug-in, everything will go missing. You can probably add a more correct code to functions.php

    Plugin Author YITHEMES

    (@yithemes)

    Hello there,

    thanks for contacting us! ??

    Please, could you try to add this custom code in the functions.php of your active theme?

    remove_action( 'ywar_summary_prepend', array( YITH_WooCommerce_Advanced_Reviews::get_instance(), 'add_reviews_average_info' ) );
    if (!function_exists('ywar_summary_prepend_custom')){
    	add_action('ywar_summary_prepend', 'ywar_summary_prepend_custom');
    
    	function ywar_summary_prepend_custom( $product ){
    		if ( get_option( 'woocommerce_enable_review_rating' ) === 'no' ) {
    			return;
    		}
    		$instance = YITH_WooCommerce_Advanced_Reviews::get_instance();
    		$product_id = yit_get_prop( $product, 'id' );
    		$average    = $instance->get_average_rating( $product_id );
    
    		$count      = count( $instance->get_product_reviews_by_rating( $product_id ) );
    		$rated_text = sprintf( __( 'Rated %s out of 5 stars', 'yith-woocommerce-advanced-reviews' ), esc_html( $average ) );
    		?>
    		<div class="woocommerce-product-rating">
    			<div class="star-rating" title="<?php $rated_text; ?>">
                            <span style="width:<?php echo( ( $average / 5 ) * 100 ); ?>%">
    	                        <span class="review-rating-value"><?php echo $rated_text; ?></span>
                            </span>
    			</div>
    			<span class="ywar_review_count"><?php printf( "%d %s", $count, _n( " review", " reviews", $count, 'yith-woocommerce-advanced-reviews' ) ); ?></span>
    		</div>
    		<?php
    	}
    }

    Let us know!

    Thread Starter free14

    (@free14)

    This does not work with my theme. I switched to another plugin.The topic is closed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do you make an empty star appear in the goods?’ is closed to new replies.