Skip to content

Instantly share code, notes, and snippets.

@UltimateWoo
Last active March 28, 2019 12:06
Show Gist options
  • Save UltimateWoo/84e335c7d19e29d481a3bd726419b21c to your computer and use it in GitHub Desktop.
Save UltimateWoo/84e335c7d19e29d481a3bd726419b21c to your computer and use it in GitHub Desktop.
Adding custom product tabs in WooCommerce
<?php
/**
* Add a custom tab to WooCommerce products
*
* @param (array) $tabs - Registered tabs
* @return (array) $tabs - Updated array of tabs
*
* @author UltimateWoo <www.ultimatewoo.com>
*/
function uw_custom_product_tab( $tabs ) {
global $post;
$tabs['uw_custom_product_tab'] = array(
'title' => 'Test Tab',
'priority' => 50,
'callback' => function( $key, $tab ) {
echo "Our custom test tab's content, added via PHP!";
}
);
return $tabs;
}
add_action( 'woocommerce_product_tabs', 'uw_custom_product_tab' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment