Ecommerce Shopify WordPress Discussion

Vendor rating can't be recreated and shown on the product page

I am trying to show the star rating of the vendor review in my single product page from wcfm, but I am unable to find a result thus far I either get a no ratings available yet ! or all the star rating are grey. I am a beginner in coding and I have searched for the fonctions in my website's files and was able to create this (below code), but It seems that it is not fetching the right info I honestly have no idea where I went wrong. function get_vendor_rating($vendor_id) { $store_rating = 0; if (function_exists('WCFMmp') && method_exists(WCFMmp(), 'get_vendor_review_rating')) { $store_rating = WCFMmp()->get_vendor_review_rating($vendor_id); } return $store_rating; } function get_vendor_reviews_count($vendor_id, $status = 'approved') { global $wpdb; $reviews_count = 0; $sql = "SELECT COUNT(ID) FROM {$wpdb->prefix}wcfm_marketplace_reviews WHERE vendor_id = %d AND approved = %d"; $reviews_count = $wpdb->get_var($wpdb->prepare($sql, $vendor_id, ($status === 'approved' ? 1 : 0))); return $reviews_count; } function display_vendor_rating() { global $product; $product_id = $product->get_id(); $vendor_id = get_post_field('post_author', $product_id); echo '<div style="display: none;">Product ID: ' . $product_id . '</div>'; echo '<div style="display: none;">Vendor ID: ' . $vendor_id . '</div>'; $vendor_rating = get_vendor_rating($vendor_id); if ($vendor_rating || $vendor_rating === 0) {rating is explicitly 0 $count = get_vendor_reviews_count($vendor_id); $star_rating_html = wp_star_rating(array( 'rating' => $vendor_rating, 'type' => 'rating', 'number' => $count, 'echo' => false, )); echo '<div class="vendor-rating">' . $star_rating_html . '</div>'; } else { echo '<div class="vendor-rating">No ratings found yet!</div>'; } } add_action('woocommerce_single_product_summary', 'display_vendor_rating', 60); I am putting the code in fonction.php btw as I don't want to break anything. Thank you in advance
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.