Hide Attribute based on Category
-
Hi everyone,
I am looking to hide a single product custom attribute when a specific category is attached to a product. I am thinking there may be some PHP code to do this. Something like this code here, but other then removing images, it can hide a single custom attribute
/** * 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 }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Hide Attribute based on Category’ is closed to new replies.