Remove product content based on category in WooCommerce

The following code will remove product images on single product pages within the ‘Cookware’ category.

Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Dessky Snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be overwritten completely when you update the theme.

/**
 * Remove product content based on category
 */
add_action( 'wp', 'remove_product_content' );
function remove_product_content() {
	// If a product in the 'Cookware' category is being viewed…
	if ( is_product() && has_term( 'Cookware', 'product_cat' ) ) {
		//… Remove the images
		remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
		// For a full list of what can be removed please see woocommerce-hooks.php
	}
}