WC_Product::is_visible_core │ protected │ WC 1.0

Returns whether or not the product is visible in the catalog (doesn't trigger filters).

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

Хуков нет.

Возвращает

bool.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->is_visible_core();

Код WC_Product::is_visible_core() WC 11.1.2

protected function is_visible_core() {
	$visible = CatalogVisibility::VISIBLE === $this->get_catalog_visibility() || ( is_search() && CatalogVisibility::SEARCH === $this->get_catalog_visibility() ) || ( ! is_search() && CatalogVisibility::CATALOG === $this->get_catalog_visibility() );

	if ( ProductStatus::TRASH === $this->get_status() || ! $this->is_viewable() ) {
		$visible = false;
	}

	if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $this->is_in_stock() ) {
		$visible = false;
	}

	return $visible;
}