Snippet: Disable WooCommerce Placeholder Image
This snippet will disable the default placeholder image displayed by WooCommerce whenever a product doesn't have a defined featured image.
// Remove placeholder image.
add_filter( 'woocommerce_placeholder_img_src', '__return_empty_string' );
add_filter( 'woocommerce_placeholder_img', '__return_empty_string' );
// Prevent WooCommerce from showing empty image in gallery.
add_filter( 'woocommerce_single_product_image_thumbnail_html', function( $html, $post_thumbnail_id ) {
if ( ! $post_thumbnail_id ) {
return;
}
return $html;
}, 10, 2 );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend WPCode)