Skip to content

Instantly share code, notes, and snippets.

@woogist
Created May 8, 2013 15:54
Show Gist options
  • Save woogist/5541418 to your computer and use it in GitHub Desktop.
Save woogist/5541418 to your computer and use it in GitHub Desktop.
WooCommerce - Change Placeholder Image
/*
* goes in theme functions.php or a custom plugin. Replace the image filename/path with your own :)
*
**/
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 = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
$src = $uploads . '/2012/07/thumb1.jpg';
return $src;
}
}
@ajdinmore
Copy link

@ChrisChiera That's the function that's depreciated, the filter is still correct.

@braddalton
Copy link

braddalton commented Sep 8, 2018

This is what is in woocommerce > includes > wc-product-functions.php around line 282

function wc_placeholder_img_src() {
	return apply_filters( 'woocommerce_placeholder_img_src', WC()->plugin_url() . '/assets/images/placeholder.png' );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment