Automattic\WooCommerce\Blocks

CoreBreadcrumbsCompatibility::is_product_search │ private │ WC 1.0

Check whether the current request is a product search.

Method of the class: CoreBreadcrumbsCompatibility{}

No Hooks.

Returns

bool. Whether the current request is a product search.

Usage

// private - for code of main (parent) class only
$result = $this->is_product_search(): bool;

CoreBreadcrumbsCompatibility::is_product_search() code 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();
}