Okay
  Public Ticket #890397
Product Images on Variable Products
Closed

Comments

  •  2
    scott started the conversation

    Hi, 

    I've a problem with displaying images for variable products.  

    There is only one image set for each product variation.  There is an image set at the top level 'Product Image' so that an image is displayed in the searches and browsing categories.

    First time onto the page the default image is displayed correctly however there are navigation icons shown when you hover over the image, clicking on them shows a placeholder image.

    If you then navigate to a variation then the incorrect version of the image is shown - I would have expected the larger version to be displayed. Using the navigation then shows the larger version then the placeholder version.

    If I navigate back to the default variation again, I get the smaller image then I get the last product variation image shown if I use the navigation.

    All plugins have been updated.

    Thanks

    Scott

  •   scott replied privately
  • [deleted] replied

    Hi Scott,

    Can you please share your FTP credentials here, because I need to login to your site and test this issue. Your information is safe here (private) in this thread.

    Make sure to choose Private Reply when you send us sensitive information!

  •   scott replied privately
  • [deleted] replied

    Hi Scott,

    I've added the following code in functions.php:

    // Variation Images Quality
    function variation_images_quality( $variation_params, $obj, $variation ) {
    $variation_params['image_src'] = $variation_params['image_link'];
    return $variation_params;
    }

    add_filter( 'woocommerce_available_variation', 'variation_images_quality', 10, 3 );

    Which has fixed the issue with low quality images. Please check and confirm if this is working for you:

    http://kewkiiv2.com/product/breakfast-aga-large-tea-pot-test/

  •  2
    scott replied

    Hi 

    Thanks for looking at it, but I'm not seeing any difference on the page. I'm still getting multiple images when there is only one specified against the product variation?

    Thanks

    Scott

  • [deleted] replied

    Hi Scott,

    The problem was with "adaptive" images, so if I add this code:

    add_filter( 'wp_get_attachment_image_attributes', function( $attr )
    {
    if( isset( $attr['sizes'] ) )
    unset( $attr['sizes'] );

    if( isset( $attr['srcset'] ) )
    unset( $attr['srcset'] );

    return $attr;

    }, PHP_INT_MAX );


    add_filter( 'wp_calculate_image_sizes', '__return_false', PHP_INT_MAX );
    add_filter( 'wp_calculate_image_srcset', '__return_false', PHP_INT_MAX );

    It fixes the issue. You can check it is working now.

  •   scott replied privately
  • [deleted] replied

    Hi Scott,

    Oh, it was a bug in our code. It consisted that products that have only one image it will show the "empty image placeholder" but it should show when there is no image at all.

    Fixed this issue.

  •  2
    scott replied

    Hi,

    Many thanks :) 

    Regards

    Scott