fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Mismatched thumbnail selection with Woocommerce

Hello,

I have a code in my functions php that hides the featured image on each product. This is causing issues with the slider, and causing the incorrect thumbnail to be highlighted.

You can see what I am talking about on any product on www.ryanjmontgomery.com

Please let me know what is the best thing to do to fix this

Hakik Zaman

Hello Ryan,

Thanks for reaching out to us. Did you remove any hook?

Basically, we discourage removing basic hooks of WooCommerce

Thanks

Hello. I have not removed any hooks. I have only installed the plugin with the code to hide featured photo in functions.php already active

Thanks

Hakik Zaman

Hi Ryan,

Could you share your code?

Thank You

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;
}

Hakik Zaman

Hello Ryan,

Thanks for sharing your code. Please check here, you have added a filter hook that is overriding our plugins code.

That’s why this problem occurred.

Thanks

Hakik Zaman

Hi Ryan,

Sorry for the delay.

We have added a feature to remove the feature image only for you.

Please update your gallery plugin and let us know your thoughts.

Hope to hear from you soon!

Thank You

Sorry I didn’t reply to say thank you for adding the feature to remove featured image! This is very useful.

Hakik Zaman

Hi Ryan,

Thank you very much for getting back to us.

We really get excited & honored when you use our plugin on your site.

If you found my support helpful and love our plugin, my humble request to you to write your beautiful words here: https://wordpress.org/support/plugin/woo-variation-gallery/reviews/?filter=5

Your beautiful words keep us inspired.

Thank You