Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks
Product_Collection::render_product_grid
Render product grid using HTML table structure for email compatibility.
Method of the class: Product_Collection{}
No Hooks.
Returns
String.
Usage
// private - for code of main (parent) class only $result = $this->render_product_grid( $products, $inner_block, $collection_type ): string;
- $products(array) (required)
- Array of WC_Product objects.
- $inner_block(array) (required)
- Inner block data.
- $collection_type(string) (required)
- Collection type identifier.
Product_Collection::render_product_grid() Product Collection::render product grid code WC 10.5.0
private function render_product_grid( array $products, array $inner_block, string $collection_type ): string {
// We start with supporting 1 product per row.
$content = '';
foreach ( $products as $product ) {
$content .= $this->add_spacer(
$this->render_product_content( $product, $inner_block, $collection_type ),
$inner_block['email_attrs'] ?? array()
);
}
return $content;
}