• Resolved Regz

    (@reagan02)


    Hi,
    I have an issue regarding the color variation. Each variation has an additional image. So when I click any of the colors e.g white. It displays the white product and when I add to cart and in the add to cart page it displays the wrong color, not the selected color. It displays the featured image of the product.
    I did try to debug the issue. I disabled the main WordPress Theme and use the default one but still not working. I tried removing the featured image but still not working.

    Check the link
    https://ibb.co/2Fqcj4M

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Group Of Oceninfo

    (@princebhalani143)

    Hi @reagan02

    Can you please try below code under child theme functions.php?

    /* Showing Product Image on Checkout Page */
    add_action('woocommerce_before_checkout_form', 'displays_cart_products_feature_image');
    function displays_cart_products_feature_image() {
    foreach ( WC()->cart->get_cart() as $cart_item ) {
    $item = $cart_item['data'];
    //print_r($item);
    if(!empty($item)){
    $product = new WC_product($item->id);
    // $image = wp_get_attachment_image_src( get_post_thumbnail_id( $product->ID ), 'single-post-thumbnail' );
    echo $product->get_image();
    echo $product->name;
    echo $product->price;
    // to display only the first product image remove comment the line bellow
    // break;
    }
    }
    }

    Reference: https://www.ads-software.com/support/topic/variable-product-image-on-checkout-page/

    Thread Starter Regz

    (@reagan02)

    Hi @princebhalani143

    Thanks for replying to my message. I did but still not working.

    Thread Starter Regz

    (@reagan02)

    Hi Guys, this is resolved!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Additional Image Variation Display in Cart page’ is closed to new replies.