Hide product details tab

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 6 reply threads
  • Author
    Posts
    • #92960
      kaloomee
      Participant

      Hi

      I would like to hide the ‘Store policies tab’ for listings located in a selected category

      Would you be able to provide code snippet for this please
      ie – If product category = A – do not display ‘Store policies’ tab

      Thank you

    • #93552
      WCFM Forum
      Keymaster

      HI,

      Please know me that particular product category id.

      Thank You

    • #93789
      kaloomee
      Participant

      HI, Category id – 386
      Thank you

    • #94053
      WCFM Forum
      Keymaster

      Thanks, will give you code for this.

    • #96449
      WCFM Forum
      Keymaster

      HI,

      Really sorry for the delayed update. Here is your code for the purpose-

      add_filter( 'woocommerce_product_tabs', function( $tabs ) {
      	global $WCFM, $WCFMmp, $product;
      	
      	if( $product && isset( $tabs['wcfm_policies_tab'] ) ) {
      		$product_id = $product->get_id();
      		if( $product_id ) {
      			$pcategories = get_the_terms( $product_id, 'product_cat' );
      			if( !empty($pcategories) ) {
      				foreach($pcategories as $pkey => $pcategory) {
      					if( $pcategory->term_id == 386 ) {
      						unset( $tabs['wcfm_policies_tab'] );
      						break;
      					}
      				}
      			}
      		}
      	}
      	return $tabs;
      }, 500 );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      Thank You

    • #96483
      kaloomee
      Participant

      Most excellent, Thank you

      Code works perfectly

    • #96693
      WCFM Forum
      Keymaster

      Great … thanks for the update 🙂

Viewing 6 reply threads
  • The topic ‘Hide product details tab’ is closed to new replies.