Product variation image is not being displayed woocommerce

  • Product variation image is not being displayed woocommerce
    Viewing 3 posts - 1 through 3 (of 3 total)

  • andrei
    Participant
    #1746

    I like very much circleflip theme a great product! Could you please take a look at the following issue:

    I’m adding variable products.
    Each variation has its own image.
    I’m expecting the main image on the page to change when I choose a variation.
    The correct variation is being added to the cart, but not being displayed in the featured image box. When loading woocommerce template this feature is working. Also woocommerce reports that review-order.php (in circleflip theme) version 2.1.0 is out of date. The core version is 2.1.8.
    Could you please take a look and let me know what I should do to fix this?


    a.rady
    Keymaster
    #1750

    Hello Andrei,

    I just committed a fix for this issue into our codebase, which will be available in the next update ( 24-48 hours ).

    but you don’t need to wait you can apply the changes on your own, here is the code:

    1- file THEME DIRECTORY/woocommerce/single-product/product-image.php
    change line #15 from <div class="postImage"> To <div class="postImage images">

    2- file THEME DIRECTORY/js/site.js, add this code at line #446
    /**
    * make Product variation images work in single product views
    */
    if ( 'object' === typeof $variation_form ) {
    var $productImageContainer = $( '.postImage' );
    $variation_form
    .on( 'found_variation', function( event, variation ) {
    if ( ! variation.image_link ) {
    return;
    }
    $productImageContainer.trigger( 'zoom.destroy' ).zoom( {
    url: variation.image_link
    } );
    } )
    .on( 'reset_image', function( event ) {
    $productImageContainer.trigger( 'zoom.destroy' ).zoom( {
    url: $productImageContainer.find( 'div[data-full]' ).data( 'full' )
    } );
    } );
    }

    3- file THEME DIRECTORY/functions.php, add this code at the end of the file
    /** add 'wc-add-to-cart-variation' script as a dependency for 'circleflip-site'.
    *
    * ensures that $variation_form variable is defined before site.js is called.
    *
    * @global WP_Scripts $wp_scripts
    */
    function circleflip_add_woocommerce_script_dependency( $template_name ) {
    global $wp_scripts;
    if ( ! function_exists( 'is_product' ) || ! is_product() || 'single-product/add-to-cart/variable.php' !== $template_name ) {
    return;
    }
    $circleflip_site_script = $wp_scripts->query( 'circleflip-site' );
    if ( $circleflip_site_script instanceof _WP_Dependency && $wp_scripts->query( 'wc-add-to-cart-variation' ) ) {
    $circleflip_site_script->deps[] = 'wc-add-to-cart-variation';
    }
    }
    add_action( 'woocommerce_before_template_part', 'circleflip_add_woocommerce_script_dependency', 10, 2 );

    Regards


    andrei
    Participant
    #1754

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Product variation image is not being displayed woocommerce’ is closed to new replies.