Advertisement
tommyosheawebdesign

Remove WooCommerce Tabs Per Product ID

Nov 14th, 2020
1,036
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. add_filter( 'woocommerce_product_tabs', 'removing_product_tabs', 98 );
  2. function removing_product_tabs( $tabs ) {
  3.     // Get the global product object
  4.     global $product;
  5.  
  6.     // HERE define your specific product Ids
  7.     $targeted_ids = array( 37, 56, 63 );
  8.  
  9.     if( $product->is_type( 'simple' ) && in_array( $product->get_id(), $targeted_ids ) ) {
  10.         unset( $tabs['description'] );            // Remove the description tab
  11.         unset( $tabs['reviews'] );                // Remove the reviews tab
  12.         unset( $tabs['additional_information'] ); // Remove the additional information tab      
  13.     }
  14.  
  15.     r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement