# Custom Placeholder Image for Products

> Replaces the grey WooCommerce placeholder with your own image for products that do not have a featured image yet.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, images, placeholder
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-custom-placeholder-image/

## Code

```php
add_filter( 'woocommerce_placeholder_img_src', function ( $src ) {
    $image_url = ''; // Full URL of your placeholder image.

    return $image_url ? esc_url( $image_url ) : $src;
} );
```

## Notes

Upload the image to the Media Library and paste its URL into $image_url.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Custom Placeholder Image for Products" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
