1. Home
  2. WC Vendors Pro
  3. Add Vendor Ratings / Feedback to Product Page
  1. Home
  2. Code Snippets
  3. Add Vendor Ratings / Feedback to Product Page

Add Vendor Ratings / Feedback to Product Page

This will show the vendor’s star rating and link to the ratings/feedback page on the product page.
Use a different WooCommerce product page hook if you wish the ratings stars & link to show in a different location on the product page.

add_action('woocommerce_before_add_to_cart_form','vendor_feedback_product_page');
function vendor_feedback_product_page() {
	$vendor_id   		= get_the_author_meta('ID');
	$vendor_shop 		= urldecode( get_query_var( 'vendor_shop' ) ); 
	
	if ( 'yes' != WCVendors_Pro::get_option( 'ratings_management_cap' ) ) {
		echo WCVendors_Pro_Ratings_Controller::ratings_link( $vendor_id, true );
	}
}

actions

Updated on January 8, 2021

Was this article helpful?