woocommerce_blocks_product_grid_item_html filter-hookWC 2.2.0

Filters the HTML for products in the grid.

Usage

add_filter( 'woocommerce_blocks_product_grid_item_html', 'wp_kama_woocommerce_blocks_product_grid_item_html_filter', 10, 3 );

/**
 * Function for `woocommerce_blocks_product_grid_item_html` filter-hook.
 * 
 * @param string      $html    Product grid item HTML.
 * @param array       $data    Product data passed to the template.
 * @param \WC_Product $product Product object.
 *
 * @return string
 */
function wp_kama_woocommerce_blocks_product_grid_item_html_filter( $html, $data, $product ){

	// filter...
	return $html;
}
$html(string)
Product grid item HTML.
$data(array)
Product data passed to the template.
$product(\WC_Product)
Product object.

Changelog

Since 2.2.0 Introduced.

Where the hook is called

AbstractProductGrid::render_product()
woocommerce_blocks_product_grid_item_html
woocommerce/src/Blocks/BlockTypes/AbstractProductGrid.php 512-526
return apply_filters(
	'woocommerce_blocks_product_grid_item_html',
	"<li class=\"wc-block-grid__product\">
		<a href=\"{$data->permalink}\" class=\"wc-block-grid__product-link\">
			{$data->badge}
			{$data->image}
			{$data->title}
		</a>
		{$data->price}
		{$data->rating}
		{$data->button}
	</li>",
	$data,
	$product
);

Where the hook is used in WooCommerce

Usage not found.