WC_Product_Grouped::get_price_html()publicWC 1.0

Returns the price in html format.

Method of the class: WC_Product_Grouped{}

Return

String.

Usage

$WC_Product_Grouped = new WC_Product_Grouped();
$WC_Product_Grouped->get_price_html( $price );
$price(string)
.
Default: ''

WC_Product_Grouped::get_price_html() code WC 8.7.0

public function get_price_html( $price = '' ) {
	$tax_display_mode = get_option( 'woocommerce_tax_display_shop' );
	$child_prices     = array();
	$children         = array_filter( array_map( 'wc_get_product', $this->get_children() ), 'wc_products_array_filter_visible_grouped' );

	foreach ( $children as $child ) {
		if ( '' !== $child->get_price() ) {
			$child_prices[] = 'incl' === $tax_display_mode ? wc_get_price_including_tax( $child ) : wc_get_price_excluding_tax( $child );
		}
	}

	if ( ! empty( $child_prices ) ) {
		$min_price = min( $child_prices );
		$max_price = max( $child_prices );
	} else {
		$min_price = '';
		$max_price = '';
	}

	if ( '' !== $min_price ) {
		if ( $min_price !== $max_price ) {
			$price = wc_format_price_range( $min_price, $max_price );
		} else {
			$price = wc_price( $min_price );
		}

		$is_free = 0 === $min_price && 0 === $max_price;

		if ( $is_free ) {
			$price = apply_filters( 'woocommerce_grouped_free_price_html', __( 'Free!', 'woocommerce' ), $this );
		} else {
			$price = apply_filters( 'woocommerce_grouped_price_html', $price . $this->get_price_suffix(), $this, $child_prices );
		}
	} else {
		$price = apply_filters( 'woocommerce_grouped_empty_price_html', '', $this );
	}

	return apply_filters( 'woocommerce_get_price_html', $price, $this );
}