Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active May 31, 2021 13:06
Show Gist options
  • Save woogists/c15230393ba094d9da33a19a02e20a15 to your computer and use it in GitHub Desktop.
Save woogists/c15230393ba094d9da33a19a02e20a15 to your computer and use it in GitHub Desktop.
[Frontend Snippets][Editing product data tabs] Add a custom 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>';
}
@xewonder
Copy link

xewonder commented Feb 3, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment