How to Hide Product Image on Cart Page WooCommerce

WooCommerce Hide Product Image on CartFor you to run an effective WooCommerce store, it would help if you add product images. Product images are important in any online store because they create an impression on the buyer. Moreover, a product image enhances the product description, which makes it appealing for the visitors.

Additionally, a product image helps the customer to visualize the product before making a purchase. They help customers to have an idea of how it would suit their utility.

Moreover, I highly recommend that you add at least four or five angular pictures that are of good quality. If upload low-quality images, customers will not be able to zoom into the pictures. Preferably, all your product images should have plain white backgrounds.

WooCommerce Hide Product Image on Cart Page

There are certain pages where you might want to hide or remove the images. For example, to optimize the cart page, you might want to remove the images. This will ensure that customers on your store can proceed to the checkout quickly. This is because the customer has already seen the image on the shop and product page.

In this post, you will see how it is very easy to hide images on the cart page. By default, the WooCommerce cart page includes product images and links to the product page for each item in the cart, as shown below:default cart page

However, WooCommerce is flexible to customization. This means you can customize this page with a couple of handy filters to change the cart elements.

Steps to Hide Product Images on the Cart Page

Here are the steps that you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to hide product images and links on the cart page.
  3. Add the following code to the functions.php file:
add_filter( 'woocommerce_cart_item_thumbnail', '__return_false' );

function njengah_remove_cart_product_link( $product_link, $cart_item, $cart_item_key ) {

$product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );

return $product->get_title();

}

add_filter( 'woocommerce_cart_item_name', 'njengah_remove_cart_product_link', 10, 3 );
  1. This is the outcome on the front end:hide product image and link on the cart page

How the Code Works

In the code snippet above, hides WooCommerce product images from the cart easily using the woocommerce_cart_item_thumbnail filter, by setting it to return a false.

To remove the links to WooCommerce product pages in the cart requires a slightly longer snippet. I have used the woocommerce_cart_item_name filter. Typically, this uses something like <a href="product_url">product_name</a>, but I forced it to return the product name instead.

Conclusion

Product images are the primary tools for convincing customers on your store. However, they might not be needed on the cart page depending on your design. Moreover, I have highlighted that images on your store need to be of good quality. This post aims to teach you how to hide the product images and links on the cart page. However, if you need some help, please consider hiring a qualified WordPress developer, so that you do not break down your site.

Similar Articles