Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions

GroupedProductItem::renderprotectedWC 1.0

Render the block.

Method of the class: GroupedProductItem{}

No Hooks.

Returns

String. Rendered block output.

Usage

// protected - for code of main (parent) or child class
$result = $this->render( $attributes, $content, $block ): string;
$attributes(array) (required)
Block attributes.
$content(string) (required)
Block content.
$block(WP_Block) (required)
Block instance.

GroupedProductItem::render() code WC 10.7.0

protected function render( $attributes, $content, $block ): string {
	global $product;

	if ( ! $product instanceof \WC_Product_Grouped ) {
		return '';
	}

	$content = '';

	// No need to prime post caches here, children are already cached at this point.
	$children = array_filter( array_map( 'wc_get_product', $product->get_children() ), 'wc_products_array_filter_visible_grouped' );

	foreach ( $children as $child ) {
		$content .= $this->get_product_row( $child->get_id(), $attributes, $block );
	}

	return $content;
}