|

Remove Images from WooCommerce pages

single Product Pages

Here’s a handy tutorial on removing product images from the single WooCommerce product page. The basic idea is that we’ll want to remove the action that adds WooCommerce images.

We can do so by adding this snippet into our child functions.php or the Code Snippets plugin:

1
2
// Remove image from product pages
remove_action( ‘woocommerce_before_single_product_summary’, ‘woocommerce_show_product_images’, 20 );
However, this won’t remove the sale badge if your product is on sale, which will look kind of funny without an image. We’ll need to add another snippet right below this to remove sale badges as well:

1
2
// Remove sale badge from product page
remove_action( ‘woocommerce_before_single_product_summary’, ‘woocommerce_show_product_sale_flash’, 10 );
The only issue is that the product page will now have a big gap in it. We can fix this with some custom styling, but this may change depending on your theme. Adding something similar to this to your child CSS stylesheet or custom CSS plugin should do the trick:

1
.woocommerce-page #content div.product div.summary { width:100%; }
However, this will depend on your theme, and you may have to ask your theme developer for help on this one if you’re not sure what class / id to target.

Cart Pages

Removing thumbnails from the cart pages is the easiest change to fix – there’s a handy filter available for us to change the product thumbnail easily. Let’s just return this as “empty” so the thumbnail isn’t displayed. We can put this in the Code Snippets plugin or a child functions.php.

1
2
// Remove product thumbnail from the cart page
add_filter( ‘woocommerce_cart_item_thumbnail’, ‘__return_empty_string’ );
There will be a pretty tiny gap in your cart table, so you may not need to adjust styling to compensate. However, this again will depend on your theme. Using a default theme, you can adjust your child stylesheet with the following CSS:

1
.woocommerce table.cart .product-thumbnail { display:none; }
Again, this will depend on your theme’s styling.

Shop Loop

Finally, let’s remove the product images from the shop pages. This is again an action we need to remove in the shop template. We can add this code to our child functions.php or to our Code Snippets:

1
2
// Remove product images from the shop loop
remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_thumbnail’, 10 );
However, we have the same issue as the product page – we may have sale badges left over that will now look kind of funny without an image to sit on. We can remove these from the shop page as well by placing this snippet right below the previous one.

1
2
// Remove sale badges from the shop loop
remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_show_product_loop_sale_flash’, 10 );

Similar Posts