WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\BlockTypes

ProductCategories::get_image_html() public WC 1.0

Returns the category image html

{} It's a method of the class: ProductCategories{}

No Hooks.

Return

String.

Usage

$ProductCategories = new ProductCategories();
$ProductCategories->get_image_html( $category, $attributes, $size );
$category(\WP_Term) (required)
Term object.
$attributes(array) (required)
Block attributes.
Default: empty array
$size(string)
Image size.
Default: 'woocommerce_thumbnail'

Code of ProductCategories::get_image_html() WC 5.6.0

public function get_image_html( $category, $attributes, $size = 'woocommerce_thumbnail' ) {
	if ( empty( $attributes['hasImage'] ) ) {
		return '';
	}

	$image_id = get_term_meta( $category->term_id, 'thumbnail_id', true );

	if ( ! $image_id ) {
		return '<span class="wc-block-product-categories-list-item__image wc-block-product-categories-list-item__image--placeholder">' . wc_placeholder_img( 'woocommerce_thumbnail' ) . '</span>';
	}

	return '<span class="wc-block-product-categories-list-item__image">' . wp_get_attachment_image( $image_id, 'woocommerce_thumbnail' ) . '</span>';
}