Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › Hide product details tab
- This topic has 6 replies, 2 voices, and was last updated 5 years, 1 month ago by WCFM Forum.
- AuthorPosts
- November 19, 2019 at 4:36 pm #92960kaloomeeParticipant
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’ tabThank you
- November 23, 2019 at 10:45 am #93552WCFM ForumMember
HI,
Please know me that particular product category id.
Thank You
- November 24, 2019 at 11:08 pm #93789kaloomeeParticipant
HI, Category id – 386
Thank you - November 26, 2019 at 4:00 pm #94053WCFM ForumMember
Thanks, will give you code for this.
- December 7, 2019 at 2:40 pm #96449WCFM ForumMember
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
- December 7, 2019 at 5:37 pm #96483kaloomeeParticipant
Most excellent, Thank you
Code works perfectly
- December 9, 2019 at 12:57 pm #96693WCFM ForumMember
Great … thanks for the update 🙂
- AuthorPosts
- The topic ‘Hide product details tab’ is closed to new replies.