WC_Comments::comments_open()public staticWC 3.1.0

See if comments are open.

Method of the class: WC_Comments{}

No Hooks.

Return

true|false.

Usage

$result = WC_Comments::comments_open( $open, $post_id );
$open(true|false) (required)
Whether the current post is open for comments.
$post_id(int) (required)
Post ID.

Changelog

Since 3.1.0 Introduced.

WC_Comments::comments_open() code WC 8.6.1

public static function comments_open( $open, $post_id ) {
	if ( 'product' === get_post_type( $post_id ) && ! post_type_supports( 'product', 'comments' ) ) {
		$open = false;
	}
	return $open;
}