Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions
GroupedProductItem::render
Render the block.
Метод класса: GroupedProductItem{}
Хуков нет.
Возвращает
Строку. Rendered block output.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->render( $attributes, $content, $block ): string;
- $attributes(массив) (обязательный)
- Block attributes.
- $content(строка) (обязательный)
- Block content.
- $block(WP_Block) (обязательный)
- Block instance.
Код GroupedProductItem::render() GroupedProductItem::render WC 10.3.6
protected function render( $attributes, $content, $block ): string {
global $product;
if ( ! $product instanceof \WC_Product_Grouped ) {
return '';
}
$content = '';
$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;
}