If you have a store with hundreds of products it can be a little annoying to have to turn off comments on every product page. But, you can add a few lines of code to a file in your mu-plugins directory, or your theme’s functions.php file.
This will turn off comments on your single product pages.
/**
* Filter whether the current post is open for comments.
*
* @param bool $open Whether the current post is open for comments.
* @param int|WP_Post $post_id The post ID or WP_Post object.
*/
function wpec_no_single_product_page_comments( $open, $post_id ) {
if ( $open && is_singular() ) {
$post_type = get_post_type( $post_id );
if ( 'wpsc-product' == $post_type ) {
$open = false;
}
}
return $open;
}
add_filter( 'comments_open', 'wpec_no_single_product_page_comments', 10, 2 );