wc_placeholder_img_src()WC 1.0

Get the placeholder image URL either from media, or use the fallback image.

Hooks from the function

Return

String.

Usage

wc_placeholder_img_src( $size );
$size(string)
Thumbnail size to use.
Default: 'woocommerce_thumbnail'

wc_placeholder_img_src() code WC 9.3.3

function wc_placeholder_img_src( $size = 'woocommerce_thumbnail' ) {
	$src               = WC()->plugin_url() . '/assets/images/placeholder.png';
	$placeholder_image = get_option( 'woocommerce_placeholder_image', 0 );

	if ( ! empty( $placeholder_image ) ) {
		if ( is_numeric( $placeholder_image ) ) {
			$image = wp_get_attachment_image_src( $placeholder_image, $size );

			if ( ! empty( $image[0] ) ) {
				$src = $image[0];
			}
		} else {
			$src = $placeholder_image;
		}
	}

	return apply_filters( 'woocommerce_placeholder_img_src', $src );
}