Title: bond007f's Replies | WordPress.org

---

# bond007f

  [  ](https://wordpress.org/support/users/bond007f/)

 *   [Profile](https://wordpress.org/support/users/bond007f/)
 *   [Topics Started](https://wordpress.org/support/users/bond007f/topics/)
 *   [Replies Created](https://wordpress.org/support/users/bond007f/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/bond007f/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/bond007f/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/bond007f/engagements/)
 *   [Favorites](https://wordpress.org/support/users/bond007f/favorites/)

 Search replies:

## Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] Hide Attribute based on Category](https://wordpress.org/support/topic/hide-attribute-based-on-category/)
 *  Thread Starter [bond007f](https://wordpress.org/support/users/bond007f/)
 * (@bond007f)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/hide-attribute-based-on-category/#post-10716366)
 * Got it working with the following code
 *     ```
       add_action( 'wp', 'remove_product_content' );
       function remove_product_content() {
       	// If a product in the 'Cookware' category is being viewed...
       	if ( has_term( array('CHANDEL-AIR', 'CHANDELIER','POT RACK','VANITY','BILLIARD/ISLAND' ), 'product_cat' ) ) {
   
       		function mycode_hide_attributes_from_additional_info_tabs( $attributes, $product ) {
       	/**
       	 * Array of attributes to hide from the Additional Information
       	 * tab on single WooCommerce product pages.
       	 */
       			$hidden_attributes = [
       		'pa_item-min-length-or-square',
   
       	];
       	foreach ( $hidden_attributes as $hidden_attribute ) {
       		if ( ! isset( $attributes[ $hidden_attribute ] ) ) {
       			continue;
       		}
       		$attribute = $attributes[ $hidden_attribute ];
       		$attribute->set_visible( false );
   
       	}
   
       	return $attributes;
       }
   
       add_filter( 'woocommerce_product_get_attributes', 'mycode_hide_attributes_from_additional_info_tabs', 20, 2 );
       }
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] Hide Attribute based on Category](https://wordpress.org/support/topic/hide-attribute-based-on-category/)
 *  Thread Starter [bond007f](https://wordpress.org/support/users/bond007f/)
 * (@bond007f)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/hide-attribute-based-on-category/#post-10715658)
 * I have found the following code to hide an attribute, just need to figure out
   how to base it on category. Do you have any suggestions?
 *     ```
       		function mycode_hide_attributes_from_additional_info_tabs( $attributes, $product ) {
       	/**
       	 * Array of attributes to hide from the Additional Information
       	 * tab on single WooCommerce product pages.
       	 */
       			$hidden_attributes = [
       		'pa_item-min-length-or-square',
   
       	];
       	foreach ( $hidden_attributes as $hidden_attribute ) {
       		if ( ! isset( $attributes[ $hidden_attribute ] ) ) {
       			continue;
       		}
       		$attribute = $attributes[ $hidden_attribute ];
       		$attribute->set_visible( false );
   
       	}
       	return $attributes;
       }
   
   
       add_filter( 'woocommerce_product_get_attributes', 'mycode_hide_attributes_from_additional_info_tabs', 20, 2 );
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] Hide Attribute based on Category](https://wordpress.org/support/topic/hide-attribute-based-on-category/)
 *  Thread Starter [bond007f](https://wordpress.org/support/users/bond007f/)
 * (@bond007f)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/hide-attribute-based-on-category/#post-10713614)
 * ok so I have two images for you. In the first you will find the category Chandelier
   highlighted in yellow.
    [http://2ndave.com/capture-4.png](http://2ndave.com/capture-4.png)
 * In the second image you will see that same Chandelier category on top and the
   attribute Item Min Length or Square: lower down the page highlighted.
    [http://2ndave.com/capture-5.png](http://2ndave.com/capture-5.png)
 * What I want to do is set it up when the category is Chandelier Hide the attribute
   Item Min Length or Square: aka (pa_item-min-length-or-square) because that dimension
   is not needed for that category. Is this possible with php code put into functions.
   php
 * I would send the url, but the site is currently in construction mode and can 
   only be viewed with a login
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] Hide Attribute based on Category](https://wordpress.org/support/topic/hide-attribute-based-on-category/)
 *  Thread Starter [bond007f](https://wordpress.org/support/users/bond007f/)
 * (@bond007f)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/hide-attribute-based-on-category/#post-10709150)
 * Maybe the remove action code could uncheck the Visible on the product page box
   on this one attribute somehow

Viewing 4 replies - 1 through 4 (of 4 total)