woocommerce_blocks_product_grid_item_html
Filters the HTML for products in the grid.
Использование
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(строка)
- Product grid item HTML.
- $data(массив)
- Product data passed to the template.
- $product(\WC_Product)
- Product object.
Список изменений
С версии 2.2.0 | Введена. |
Где вызывается хук
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 );