WooCommerce is backed up by more than five million active installations in the WordPress community, and this number continues to grow every day.
This is because WooCommerce is flexible to customization and scalable.
Moreover, WooCommerce is a powerful plugin that can transform your WordPress blog into a fully-fledged eCommerce site to generate revenue.
However, not everything is straightforward.
Sometimes you may need to change a few things, some of which are not as simple as ticking a checkbox and hitting the save button. Some changes require you to go to the back end and have some code written.
WooCommerce Hide Product Gallery
WooCommerce allows you to upload a featured image and multiple thumbnail images when you create a product. These thumbnail images create a gallery that is displayed on a single product page.
This is how you can add the product gallery:
This is how the product gallery appears on the front end:
In this post, you will learn two methods to hide the Product gallery.
Moreover, I will share a bonus code snippet to hide all images on the single product page.
Steps to Hide the Product Gallery in the WooCommerce Single Product Page Using PHP
Here are the steps that you need to follow:
- Log into your WordPress site and access the Dashboard as the admin user.
- 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 the product gallery in the WooCommerce single product page.
- Click anywhere on the text editor and scroll to the bottom of the funcitons.php file. Paste the code at the end:
/** * @snippet Hide Dashboard on the My Account Page */ remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
- Click on the Save Changes button at the bottom of the text editor screen.
- Now you have successfully added the code snippet required to hide the product gallery on single product pages. This will be the outcome on the front end:
- Alternatively, you may opt to remove all the images on all the single product pages. To do this, add the following code at the bottom of your functions.php file:
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
Steps to Hide the Product Gallery in the WooCommerce Single Product Page Using CSS
Here are the steps that you need to follow:
- Log into your WordPress site and access the Dashboard as the admin user.
- From your admin dashboard, go to Appearance > Customize.
- Click Additional CSS.
- Add this piece of CSS code in the text area:
.woocommerce-product-gallery { display:none; }
- The CSS code snippet above will hide the product image. However, the short description will still align to the right side of the content area. Add the following CSS code to make it aligned to the left instead:
.woocommerce #content div.product div.summary, .woocommerce div.product div.summary, .woocommerce-page #content div.product div.summary, .woocommerce-page div.product div.summary { float: left; }
Conclusion
In this post, you have learned how to hide all the thumbnail images on all the single product pages of your WooCommerce store using both CSS and PHP.
However, if you are not familiar with code, I recommend hiring a WordPress Developer.
Joe is an experienced full-stack web developer with a decade of industry experience in the LAMP & MERN stacks, WordPress, WooCommerce, and JavaScript – (diverse portfolio). He has a passion for creating elegant and user-friendly solutions and thrives in collaborative environments. In his spare time, he enjoys exploring new tech trends, tinkering with new tools, and contributing to open-source projects. You can hire me here for your next project.
Similar Articles
- How to Hide Quantity In Stock In WooCommerce
- WooCommerce Storefront Show all Categories on the Homepage
- How to Customize Storefront Theme Using Customizer
- How to Change Add to Cart Text WooCommerce Guide with Examples
- How to Remove Breadcrumbs WooCommerce Storefront
- How to Hide Price If Zero In WooCommerce
- How to Customize Storefront Checkout Page
- How to Change WooCommerce Product Visibility Options
- How to Hide WooCommerce Registration Form
- How to Hide Order Status In WooCommerce
- How to Remove, Rename and Add Storefront Sorting Options
- How to Hide Product Prices Based on User Role Storefront
- How to Hide Product SKU In WooCommerce
- How to Hide SKU, Category, Tags Meta Product Page WooCommerce
- How to Add Text after Price in WooCommerce » Add Price Suffix
- How to Hide Read More and Add to Cart Button WooCommerce
- How to Create One Product WooCommerce Storefront Store
- How to Change Button Color Storefront Theme
- How to Change Storefront Theme Order of Products
- How to Move Price WooCommerce Storefront Hooks