Replace WooCommerce Placeholder Image

The default placeholder image in WooCommerce does not adjust according to image changes made within the Settings (e.g., changing the number of columns from 4 to 3 will result in a smaller placeholder image).

If you resize your shop layout to be more flattering to your image sizes, the default placeholder image is not going to match your carefully thought out layout.

Inject this code into your functions file, as well as your very own placeholder image to get around this issue.

// update woocommerce placeholder image 

add_action( 'init', 'custom_fix_thumbnail' );
function custom_fix_thumbnail() {
  add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
	function custom_woocommerce_placeholder_img_src( $src ) {
	$upload_dir = get_bloginfo('stylesheet_directory');
	$src = $upload_dir . '/img/woo_placeholder.jpg'; // link to your new default image
	return $src;

Modified from source.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.