woocommerce_get_product_thumbnail()
Get the product thumbnail, or the placeholder if not set.
Hooks from the function
Return
String
.
Usage
woocommerce_get_product_thumbnail( $size, $attr, $placeholder );
- $size(string)
- .
Default: 'woocommerce_thumbnail' - $attr(array)
- Image attributes.
Default: array() - $placeholder(true|false)
- True to return $placeholder if no image is found, or false to return an empty string.
Default: true
woocommerce_get_product_thumbnail() woocommerce get product thumbnail code WC 9.6.0
function woocommerce_get_product_thumbnail( $size = 'woocommerce_thumbnail', $attr = array(), $placeholder = true ) { global $product; if ( ! ( $product instanceof WC_Product ) ) { return ''; } if ( ! is_array( $attr ) ) { $attr = array(); } if ( ! is_bool( $placeholder ) ) { $placeholder = true; } $image_size = apply_filters( 'single_product_archive_thumbnail_size', $size ); return $product->get_image( $image_size, $attr, $placeholder ); }