Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #802098

    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?

    • This topic was modified 7 years, 6 months ago by MarcoCianetti.
    #802639

    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?

    #802652

    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

    #802661

    Thank you for reply,
    I tried to enter the code in functions.php , but it does not work.

    #804184

    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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.