• Resolved Dreampixdev

    (@dreampixdev)


    Hi,

    I have a problem to make the image product disappear. I don’t want to use CSS for that because I want to do that only on a few pages.

    I have written in my functions.php this line :

    remove_action( ‘woocommerce_before_single_product_summary’, ‘woocommerce_show_product_images’, 20 );

    But it seems it doesn’t walk. Could it be a problem with the theme ?

    Thank you !

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Why not use the ‘woocommerce_single_product_image_html’ filter? Return an empty string for those few pages, otherwise return the string passed to your callback unchanged. An images div will be output, but it’ll be empty if you return an empty string.

    Thread Starter Dreampixdev

    (@dreampixdev)

    Thank you for you answer, I try this.

    Thread Starter Dreampixdev

    (@dreampixdev)

    This is my code (it can be useful)

    add_filter( 'woocommerce_single_product_image_html', 'filter_woocommerce_cpproduct_image_html', 10, 2 );
    function filter_woocommerce_cpproduct_image_html($gallery, $id){
    	$product=wc_get_product($id);
    		if($product->is_type('composite')){
    			$gallery='';
    		}
    	return $gallery;
    }

    Thank you bcworkz.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove product images on some single product page’ is closed to new replies.