WooCommerce 3.0+ Single Product Image Zoom & Link Removal

Sometimes you want to do a Single Product Image Zoom & Link Removal. You just do not need the zoom effect nor do you want the image to link to the original size image. Well there are WooCommerce filters for that

Product Image Zoom Removal

To remove the product thumbnail zoom effect you can use the following filter:

function custom_single_product_image_html( $html, $post_id ) {
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
return get_the_post_thumbnail( $post_thumbnail_id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );
add_filter('woocommerce_single_product_image_thumbnail_html', 'custom_single_product_image_html', 10, 2);

It basically uses the woocommerce_single_product_image_thumbnail_html filter (see file at Github)to manipulate the product thumbnail. Instead of returning the html with zoom options it just returns:

get_the_post_thumbnail( $post_thumbnail_id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );

which is just the shop single large product thumbnail.

Product Image Link Removal

The product link is removed with this same function as well as you have now completely replaced the html with just the thumbnail instead of a thumbnail that links to the original and has zoom capabilities. So we are now all done here!

Bonus: Quantity Button Removal

If you would like to remove the quantity button as you only sell your products individually and you do not allow more than one of each you can either lock this per product or use this filter:

 * @desc Remove in all product type
function wc_remove_all_quantity_fields( $return, $product ) {
    return true;
add_filter( 'woocommerce_is_sold_individually', 'wc_remove_all_quantity_fields', 10, 2 );

To do it per product

  • Edit your product.
  • Click “Inventory”.
  • Check the box that says “Sold Individually”
Tagged in : Tagged in : ,
Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.