Hey @maven1129,
Applying tabs on a category level is something our pro plugin does automatically. I don’t recommend trying to import tabs because they’re saved as post meta. Long story short its just a lot of work and outside the scope of support here. You can import and export your products with their tabs, but there are no means at this time to dynamically import tabs. At that rate you’re so far outside the scope of this plugin you would probably be better off just looking at the WooCommerce docs and coding your own tabs plugin.
Plenty of examples how to further customize this here:
https://docs.woocommerce.com/document/editing-product-data-tabs/
Tabs are just data objects, the “design” part is handled by your theme so you can filter WooCommerce and add more data, which is exactly what this plugin does.
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
/**
* Custom Import Tabs
*
* @param array $tabs This is a collection of all your tabs. You can just replace this with a new collection if you want.
*/
function woo_reorder_tabs( $tabs ) {
// Here you could do conditional checks to see if you're in a category or not.
// that could be used to trigger a switch statement that filles this $imported_tabs array below.
// Reset tabs to a custom array with our default tabs.
$imported_tabs = [
'description' => $tabs['description'],
'reviews' => $tabs['reviews'],
'additional_information' => $tabs['additional_information'],
// Import your tabs like this shape with callbacks for the content.
'product_size' => [
'title' => __( 'Product Size Chart' ),
'callback' => 'yikes_woo_product_size_callback', // see below for callback function.
'priority' => 10 // @see WooCommerce Docs these are all shown with examples.
]
];
return $imported_tabs;
}
/**
* Custom Callback
*/
function yikes_woo_product_size_callback() {
echo '<h2>Custom Description</h2>';
echo '<p>Here\'s a custom description</p>';
}
Cheers,
Freddie
-
This reply was modified 4 years, 5 months ago by
Freddie.