Hi,
I try to follow every step to make a product with 6 variables, but when the product has the main image, the 6 variable (once selected) does not change the image. If the main image is removed, the variable shows its own image.
I have to wait for a update of enfold or woocommerce?
I did a test with another site with different template and it works correctly.
So the problem is enfold not woocommerce.
Do I need to change the settings?
Add css?
Hi,
Can you please try adding following code to Functions.php file in Appearance > Editor
function av_variation_product_image(){
?>
jQuery(window).load(function(){
jQuery('select:first').change(function(){$name=this.name;$variation=jQuery(this).val();
if($variation!==''){
$productVariations=jQuery.parseJSON(jQuery('form.variations_form').attr('data-product_variations'));
for($i=0;$productVariations.length-1;$i++){if($productVariations[$i]['attributes'][$name]===$variation){$image=$productVariations[$i]['image']['src'];break;}}
jQuery('.woocommerce-product-gallery__wrapper a').attr('href',$image);
jQuery('.woocommerce-product-gallery__wrapper>a img').attr('src',$image);
jQuery('.woocommerce-product-gallery__wrapper>a img').attr('srcset','');
}
});
});
<?php
}
add_action('wp_footer', 'av_variation_product_image');
Best regards,
Yigit
Thank you for reply,
I tried to enter the code in functions.php , but it does not work.
Hi,
We have also send the issue to our developers so they can take a look and identify the issue
It is working with other templates I can confirm, so it is something from our side.
Best regards,
Basilis