Automattic\WooCommerce\Blocks

CoreBreadcrumbsCompatibility::is_product_search │ private │ WC 1.0

Check whether the current request is a product search.

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

Хуков нет.

Возвращает

bool. Whether the current request is a product search.

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

// private - только в коде основоного (родительского) класса
$result = $this->is_product_search(): bool;

Код CoreBreadcrumbsCompatibility::is_product_search() WC 11.2.1

private function is_product_search(): bool {
	if ( ! is_search() ) {
		return false;
	}

	$post_type = get_query_var( 'post_type' );

	if ( is_array( $post_type ) ) {
		return in_array( 'product', $post_type, true );
	}

	return 'product' === $post_type || is_shop();
}