Tagged: x
-
AuthorPosts
-
September 22, 2016 at 9:29 am #1186455
Loren NParticipantHi,
I’d like to show an aggregated review star rating on product pages. I was following this thread for the same stack (integrity) and added code to functions.php as detailed but it didn’t work. In fact it gave me an error.
Can you help please?
Thanks,
LorenSeptember 22, 2016 at 11:04 am #1186573
RupokMemberHi Loren,
Thanks for writing in! This is something not related to X rather custom development for WooCommerce as it’s not part of WooCommerce as well rather extending that. I think Rad explained that on other thread – https://community.theme.co/forums/topic/aggregate-rating-not-showing-in-google-structured-data-testing-tool/page/2/#post-1134600
Thanks for understanding.
September 22, 2016 at 11:28 am #1186618
Loren NParticipant…but Christian provided a solution. I just couldn’t get the code (which seemed to be split across 2 replies) to work (maybe because I missed something like a comma or something) so I got an error.
When I change to a basic Twentysixteen theme, the review stars are present which means that its a basic and included function in Woocommerce. It’s within the X template that overrides the woocommerce one where the stars don’t show, therefore, it’s an X issue, therefore I need help to fix the X template.
September 22, 2016 at 1:00 pm #1186761
DarshanaModeratorHi there,
I have checked with the development team and this issue will be fixed in an upcoming release of X. In the meantime, try adding the following code into your child theme’s functions.php file.
add_action('after_setup_theme','woocommerce_default'); function woocommerce_default() { add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 ); } function x_woocommerce_shop_product_thumbnails_fix() { GLOBAL $product; $id = get_the_ID(); $thumb = 'entry'; $rating = $product->get_rating_html(); woocommerce_show_product_sale_flash(); echo '<div class="entry-featured">'; echo '<a href="' . get_the_permalink() . '">'; echo get_the_post_thumbnail( $id, $thumb ); if ( ! empty( $rating ) ) { echo '<div class="star-rating-container aggregate" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">' . $rating . '</div>'; } echo '</a>'; echo "</div>"; }Hope that helps.
September 22, 2016 at 1:32 pm #1186795
Loren NParticipantAwesome! Code worked perfectly and I look forward to it being included on a future X release.
Thanks.
September 22, 2016 at 1:44 pm #1186829
JoaoModeratorGlad to hear it Loren,
Have a great day and thanks for using X.
Joao
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1186455 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
