Remove Single Product Image Per Product

Add this PHP code to the end of your child themes functions file to remove a product image for 1 specific product only. Swap out the post I.D to match your single products post i.d.

add_action( 'woocommerce_before_single_product_summary', 'single_product_remove_image', 1 );
function single_product_remove_image() {
if ( is_single( '193' ) ) {
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
}
}

To remove product images for more than 1 single product, add an array to the is_single conditional tag like this

add_action( 'woocommerce_before_single_product_summary', 'single_product_remove_images', 1 );
function single_product_remove_images() {
if ( is_single(array( '192','193' ) ) ) {
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
}
}

You can also use the is_product conditional tag in replace of is_single like this :

is_product('193')

And like this :

if ( is_product() AND get_the_ID() == 193 ) {

However, you should also check if WooCommerce is active like this using class_exists

if ( class_exists( 'woocommerce' ) AND is_product() AND get_the_ID() == 193 ) {

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.