Skip to content

Instantly share code, notes, and snippets.

@roykho
Last active December 5, 2023 13:59
Show Gist options
  • Save roykho/9292693 to your computer and use it in GitHub Desktop.
Save roykho/9292693 to your computer and use it in GitHub Desktop.
WooCommerce: How to remove star review rating under the product title when enable review is off.
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'my_woocommerce_template_single_rating', 10 );
function my_woocommerce_template_single_rating() {
global $product;
if ( $product->post->comment_status === 'open' )
wc_get_template( 'single-product/rating.php' );
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment