+function custom_woo_pd_get_filename_dynamic_filename( $output, $filename ) {
+ // Check we are dealing with https://images.sample-domain.com/is/image/dynamic/products/...
+ if( strpos( $filename, 'images.sample-domain.com/is/image/dynamic/products' ) !== false ) {
+ $output = basename( $filename );
+ // Strip the filename down to the ? character
+ $pos = strpos( $output, '?' );
+ $output = substr( $output, 0, $pos );
+ // Check if the filename contains .tif and replace it with .jpg
+ if( strpos( $output, '.tif' ) == false )
+ $output = str_replace( '.tif', '.jpg', $output );
+add_filter( 'woo_pd_get_filename_dynamic_filename', 'custom_woo_pd_get_filename_dynamic_filename', 10, 2 );