This topic has 3 replies, 2 voices, and was last updated 6 years, 6 months ago ago by Rose Tyler
Hey,
On my single product pages i have a static tab set to display costum content.
Now i want to add another seperate costum tab (which is also static for all the products).
I tried to add the following code and CSS style:
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['desc_tab'] = array(
'title' => __( 'Additional Information', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
}
Content to costum tab:
function woo_new_product_tab_content() {
// The new tab content
echo '<p>Lorem Ipsum</p>';
}
But the costum tab that i inputed in the 8Theme options gets erased. That got me thinking if the this code is overwritting yours ?
Thank you,
PS: If you could add an option for more costum tabs in future theme update that would be awesome!
Edit: my mistake the second code is also for functions.php
Hello,
Please use the following snippet in functions.php file of child theme to add a custom global product tab:
/**
* Add a custom product data tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo '<h2>New Product Tab</h2>';
echo '<p>Here\'s your new product tab.</p>';
}
Regards
You must be logged in to reply to this topic.Log in/Sign up