WC_Product::is_publicly_viewable │ public │ WC 11.1.0

Whether this product is publicly viewable: the product and its parent (if it has one) are published.

Метод класса: WC_Product{}

Хуков нет.

Возвращает

bool.

Использование

$WC_Product = new WC_Product();
$WC_Product->is_publicly_viewable();

Список изменений

С версии 11.1.0 Введена.

Код WC_Product::is_publicly_viewable() WC 11.1.2

public function is_publicly_viewable() {
	$parent_id = $this->get_parent_id();

	return ProductStatus::PUBLISH === $this->get_status()
		&& ( ! $parent_id || ProductStatus::PUBLISH === get_post_status( $parent_id ) );
}