fbpx
Enjoy Year-End Sale: 50% Off All Plugins! Coupon Code: NewYear2025

Bug if product variation has only one image

Hi,

I have found a bug, if the product variations has only 1 image, when I select the color attribute your plugin hide the image and nothing is appearing. But if the product variation has 2 or more images it working perfect.

I use woocommerce additional variation images from woocommerce in the latest version.

Because it is a live site I add the same image twice as second variation images, otherwise the customer doesn’t see any images if click on color. I am using wp all import plugin for importing products.

Could you check it?

Thank you

 

Hakik Zaman

Hello Efthimios Filippidis EL113784629,

Thanks for reaching to us.

I have found a bug, if the product variations has only 1 image, when I select the color attribute your plugin hide the image and nothing is appearing.

I couldn’t find the issue you mentioned. Could you please check this? Have I missed anything? If yes please record me reproducing your issue using a tool like this? https://www.useloom.com

It helps me to quickly figure out the issue.

Thank you

As you see, if there is only one image , the image is hidden when i click the color attribute. But if the product variation has more than 2 images it is working.

Could you help us?

 

I tried to add this to function.php

add_action( ‘woocommerce_before_single_product_summary’, ‘enable_gallery_for_multiple_thumbnails_only’, 5 );
function enable_gallery_for_multiple_thumbnails_only() {
global $product;

if( ! is_a($product, ‘WC_Product’) ) {
$product = wc_get_product( get_the_id() );
}

if( empty( $product->get_gallery_image_ids() ) ) {
//if( sizeof( $product->get_gallery_image_ids() ) == 1 ) {
echo ‘<style> .woocommerce-product-gallery.woocommerce-product-gallery–with-images.woocommerce-product-gallery–columns-4.images {
display: block !important;
}
} </style>’;
}
}

 

If the product’s variations have only 1 images it works.

Example:

https://coccobello.gr/product/sorts-c06-6e11aa/

 

But if there one or more variations with more than 1 images and 1 or more variations with one images it doesn’t work.

Example:

https://coccobello.gr/product/vermouda-mako-115-6602al/

 

Hakik Zaman

Hi Efthimios,

Changing image is not feature of our plugin, is the feature of WooCommerce itself.

Could you disable our swatches plugin and check is it working without our plugin or not?

Thank you