hakukou
hakukou

Reputation: 111

WooCommerce the first product image is repeated

This Website (digitalzakka.com) has been migrated, but the first product image is repeated.

enter image description here

There are no duplicates in the product gallery.

enter image description here

I also set a product image:

enter image description here

The product image and product gallery may be duplicated.

I have 10,000 products, is there any way to solve this problem in batches?

Upvotes: 2

Views: 1838

Answers (2)

Brijesh Dhanani
Brijesh Dhanani

Reputation: 886

If you want to do it in batches then a simple solution is to remove featured images from woocommerce products. Try the following code:

add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 2);
function remove_featured_image($html, $attachment_id ) {
    global $post, $product;

    $featured_image = get_post_thumbnail_id( $post->ID );

    if ( $attachment_id == $featured_image )
        $html = '';

    return $html;
}

I ran into the same issue. I solved it through the above code.

Upvotes: 3

Krupal Panchal
Krupal Panchal

Reputation: 1545

It is happening because you have added images in two places. First in the product featured image and second one in the product gallery images.

If you add some product in the product featured image you do not need to add that image in the product gallery image. So just remove that image from gallery and check it out.

Upvotes: 0

Related Questions