Title: Using Multiple Custom Product Tab Plugins
Last modified: January 12, 2018

---

# Using Multiple Custom Product Tab Plugins

 *  Resolved [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * (@mike_oberdick)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/)
 * Got an interesting situation for you guys…I have a client who was using the default
   WooCommerce tab manager plugin. They used this for all of their products up until
   about a month ago when I developed some custom solutions for them to upload their
   products via WP All Import. I set it up using your tabs plugins and WP All Import
   integration and ran into an issue where the WooCommerce tab plugin is overriding
   your plugin so the custom tabs aren’t showing for the products which were imported
   using WP All Import.
 * Essentially, the old products use tabs built with the native WooCommerce Tab 
   Manager and all of the new products are using tabs created with your plugin. 
   Any way for them to coexist so that the old products show the WooCommerce Tab
   Manager tabs and the new products show the tabs created with your plugin?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fusing-multiple-custom-product-tab-plugins%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9869103)
 * Hi [@mike_oberdick](https://wordpress.org/support/users/mike_oberdick/),
 * I haven’t seen this issue before. Which Tabs Manager plugin is it? The paid one
   by WooCommerce ([https://woocommerce.com/products/woocommerce-tab-manager/](https://woocommerce.com/products/woocommerce-tab-manager/))?
   If it’s something I can easily download and test I will. If it’s not, I am not
   sure how to resolve this.
 * Have you confirmed that disabling the Tabs Manager plugin enables Custom Product
   Tabs (this plugin’s tabs) to work?
 * Let me know.
 * Cheers,
    Kevin.
 *  Thread Starter [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * (@mike_oberdick)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870152)
 * Thanks so much Kevin for getting back to me.
 * Yes, it’s the paid one that is causing the issue. Is there a direct e-mail where
   I can send you a link? If I disable the Tabs Manager Plugin then the Custom Product
   Tabs works fine. I’m thinking it’s an issue with priority for when the filter/
   hook is run?
    -  This reply was modified 8 years, 3 months ago by [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/).
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870176)
 * An issue with priority for the filter is possible. The plugin also claims:
 * > Even most 3rd party tabs added by other plugins will be detected, allowing 
   > you to hide or order them alongside your own tabs.
 * So I’m wondering whether that functionality is breaking something.
 * Feel free to email plugins at yikesinc dot com!
 * Thanks,
    Kevin.
 *  Thread Starter [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * (@mike_oberdick)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870210)
 * Kevin based on what you wrote, I was able to find this on their site:
 * > If your 3rd party tab relies on the global $product variable, the Tab Manager
   > won’t be able to display the tab within its default settings, which means that
   > the tab disappears :(.
   > The basic idea here is that you should add the tab even if $product is undefined
   > so that Tab Manager picks it up. If you want to conditionally show tabs on 
   > the product page, you can check if customers are on the product page ($product
   > is defined) before applying any additional conditions. This way, the filter
   > is applied on the Tab Manager layout page and the tab can be reordered.
   > Here’s some code to give you the basic idea.
 * Here’s the original page including the code snippet: [https://docs.woocommerce.com/document/tab-manager/#section-19](https://docs.woocommerce.com/document/tab-manager/#section-19)
 * I also pm’d the zip of the plugin.
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870264)
 * Thanks for finding that. I’d like to try to integrate our plugin with the tabs
   manager. If I sent you a customized snippet, would you be able to test it out?
 *  Thread Starter [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * (@mike_oberdick)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870271)
 * Yes, absolutely.
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870314)
 * Well after reading the docs a few times I don’t think this is going to work.
 * >If your 3rd party tab relies on the global $product variable, the Tab Manager
   won’t be able to display the tab within its default settings, which means that
   the tab disappears :(.
 * Our tabs function does required the global `$product` variable.
 * If I understand correctly, it is using the same front-end tab output filter on
   the admin side to make the Tabs Manager plugin understand which tabs are available.
   This is not desirable at all but I understand why they have to do it. The issue
   is that our plugin’s tab data is encapsulated into classes; we can’t just use
   the front-end function on the admin.
 * I can try something custom but I have very little confidence it is going to work.
   Here it goes…
 *     ```
       function third_party_tab( $tabs ) {
           global $product;
   
           $custom_product_tabs = $product ? get_yikes_custom_product_tabs( $product->id ) : null;
   
           if ( $product && empty( $custom_product_tabs ) ) {
               return $tabs;
           }
   
           foreach( $custom_product_tabs as $tab ) {
           	$tabs[ $tab['id'] ] = array(
           		'title'    => $tab['title'],
       	        'priority' => 30,
       	        'callback' => 'yikes_custom_product_tabs_callback',	
           	);
           }
   
           return $tabs;
       }
       add_filter( 'woocommerce_product_tabs', 'third_party_tab' );
   
       function yikes_custom_product_tabs_callback( $key, $tab ) {
       	echo apply_filters( 'the_content', $tab['content'] );
       }
   
       function get_yikes_custom_product_tabs( $product_id ) {
       	return get_post_meta( $product_id, 'yikes_woo_products_tabs', true );
       }
       ```
   
 *  Thread Starter [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * (@mike_oberdick)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870351)
 * No dice…any way to run a conditional statement that would hide the WooCommerce
   tabs and show the Yikes tabs if they are present? The new products that are being
   added to the site will only have the Yikes tabs so any products added moving 
   forward will use this plugin’s tabs and won’t need the default WC tabs.
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870377)
 * Mike,
 * I don’t think it’s possible. Custom Tabs Manager is (somehow) removing our filter
   and only using their own filter. I don’t think I would be able to hijack their
   filter to allow our filter to run.
 * I’m wondering if maybe you could export your existing Tabs Manager data and import
   it into Custom Product Tabs format. Do you know what the structure of Tabs Manager
   data looks like?
 * For non-saved tabs, our data structure is really simple. It is saved as post 
   meta under the key `'yikes_woo_products_tabs'`. It is a serialized array that,
   for example, looks like this:
 *     ```
       array(2) {
         [0]=>
         array(3) {
           ["title"]=>
           string(16) "Saved Tab 1"
           ["id"]=>
           string(16) "saved-tab-1"
           ["content"]=>
           string(12) "banana phone"
         }
         [1]=>
         array(3) {
           ["title"]=>
           string(11) "Saved Tab 2"
           ["id"]=>
           string(11) "saved-tab-2"
           ["content"]=>
           string(14) "banana phone 2"
         }
       }
       ```
   
 * Is there any way you could run a script to export Tabs Manager tabs and re-import
   them in the style of Custom Product Tabs? I might be able to help with this process.
 * Let me know,
    Kevin.
 *  Thread Starter [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * (@mike_oberdick)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9870504)
 * Interesting…I was thinking about that as a next step. So it looks like the product
   tabs are saved as custom post types (wc_product_tab) in wp_posts and the ID is
   used to associated it with post_meta (_product_tabs). So for one of the tabs 
   it looks like this in post_meta:
 * > a:3:{s:20:”core_tab_description”;a:5:{s:8:”position”;i:0;s:4:”type”;s:4:”core”;
   > s:2:”id”;s:11:”description”;s:5:”title”;s:11:”Description”;s:7:”heading”;s:
   > 19:”Product Description”;}s:17:”product_tab_22111″;a:4:{s:8:”position”;i:1;
   > s:4:”type”;s:7:”product”;s:2:”id”;s:5:”22111″;s:4:”name”;s:12:”line-drawing”;}
   > s:17:”product_tab_22112″;a:4:{s:8:”position”;i:2;s:4:”type”;s:7:”product”;s:
   > 2:”id”;s:5:”22112″;s:4:”name”;s:12:”photometrics”;}}
 * Here is a snippet from the wp_posts entry:
 * ![](https://i0.wp.com/i.imgur.com/Qm98q3n.jpg?ssl=1)
 * Here is the [post](https://grandlight.com/product/china-hat-10-incandescent-cast-aluminum-120v-area-landscape-light-2/)
   on the front-end.
    -  This reply was modified 8 years, 3 months ago by [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/).
    -  This reply was modified 8 years, 3 months ago by [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/).
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9877433)
 * For anyone wondering, Mike and I worked together to import all of the tabs from
   WC Tabs Manager ([https://woocommerce.com/products/woocommerce-tab-manager/](https://woocommerce.com/products/woocommerce-tab-manager/))
   to Custom Product Tabs.
 * For developers, this is a snippet of the code we used. (Note: please don’t copy
   this code and run it directly – there are some changes that need to made before
   running it in a real environment).
 *     ```
       // Get our products that have the'_product_tabs' post meta field
       	$wp_query_args = array(
       		'post_type'      => 'product',
       		'post_status'    => 'publish',
       		'meta_query'     => array(
       			'key'     => '_product_tabs',
       			'value'   => 'product',
       			'compare' => 'LIKE'
       		)
       	);
   
       	$products = new WP_Query( $wp_query_args );
   
       	// Make sure we have products
       	if ( $products->have_posts() ) {
   
       		global $post;
   
       		// Go through each product
       		while ( $products->have_posts() ) {
       			$products->the_post();
   
       			// Get the array of Tabs Manager tabs
       			$old_tab_data = get_post_meta( get_the_ID(), '_product_tabs', true );
   
       			// If we don't have tab data, go to the next product.
       			if ( empty( $old_tab_data ) || ! is_array( $old_tab_data ) ) {
       				continue;
       			}
   
       			// Get the array of YIKES Custom Product Tabs data
       			$new_tab_data = get_post_meta( get_the_ID(), 'yikes_woo_products_tabs', true );
   
       			// Make sure we're dealing with an array
       			$new_tab_data = is_array( $new_tab_data ) ? $new_tab_data : array();
   
       			foreach ( $old_tab_data as $tab ) {
   
       				// Don't import the description tab or we'll have duplicate descriptions
       				if ( $tab['type'] === 'core' ) {
       					continue;
       				}
   
       				// Get the wc_product_tab CPT object that this tab is based on
       				$wc_product_tab = get_post( $tab['id'] );
   
       				// Make sure we have a product tab
       				if ( empty( $wc_product_tab ) ) {
       					continue;
       				}
   
       				// Create the new tab structure for Custom Product Tabs
       				$new_tab_data[] = array(
       					'id'      => $tab['name'],                 // Slug
       					'title'   => $wc_product_tab->post_title,  // Title
       					'content' => $wc_product_tab->post_content // Content
       				);
       			}
   
       			update_post_meta( get_the_ID(), 'yikes_woo_products_tabs', $new_tab_data );
       		}
       ```
   
    -  This reply was modified 8 years, 3 months ago by [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/).
 *  Thread Starter [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * (@mike_oberdick)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9878093)
 * Thank you so much Kevin…amazing support!

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

The topic ‘Using Multiple Custom Product Tab Plugins’ is closed to new replies.

 * ![](https://ps.w.org/yikes-inc-easy-custom-woocommerce-product-tabs/assets/icon-
   256x256.png?rev=1558461)
 * [Custom Product Tabs for WooCommerce](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Active Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/reviews/)

## Tags

 * [tabs not showing](https://wordpress.org/support/topic-tag/tabs-not-showing/)

 * 12 replies
 * 2 participants
 * Last reply from: [Mike Oberdick](https://wordpress.org/support/users/mike_oberdick/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/using-multiple-custom-product-tab-plugins/#post-9878093)
 * Status: resolved