Replace HTTP product image with HTTPS image

When a Comparison Set is displayed on your site, the product images are loaded directly from the merchant's site as they are not stored in your Media Library.

If your site is HTTPS but a merchant's product image is still in HTTP, this can cause users to receive warnings or the images to not load at all.

To prevent this from happening, you can replace all HTTP images with the default WooCommerce placeholder image.

Replace HTTP images with placeholder images

Create a custom plugin

If you haven't done so already, create a custom plugin.


Add code

Add the following code to your custom plugin:

add_filter( 'dfrcs_image', function ( $html, $p ) {

   if ( isset( $p['image'] ) && strpos( $p['image'], 'https' ) === 0 ) {
      return $html;

   return sprintf( '<img src="%s" />', wc_placeholder_img_src() );
}, 20, 2 );


Save your changes.


Email the Affiliate Manager

It's best to let the merchant's affiliate manager know that they also need to update their feeds so that their image URLs are HTTPS instead of HTTP.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us