Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Last active October 13, 2015 21:38
Show Gist options
  • Save claudiosanches/4259294 to your computer and use it in GitHub Desktop.
Save claudiosanches/4259294 to your computer and use it in GitHub Desktop.
WooCommerce - Add new tab in products
<?php
// WooCommerce Hooks.
add_action( 'woocommerce_product_tabs', 'cs_add_product_tab' );
add_action( 'cs_display_product_tab', 'cs_display_product_tab' );
/**
* Add the new tab.
*/
function cs_add_product_tab( $tabs ) {
$tabs['nome_da_tab'] = array(
'title' => __( 'Titulo da Tab', 'woocommerce' ),
'priority' => 60,
'callback' => 'cs_display_product_tab'
);
return $tabs;
}
/**
* Create a display for the new tab.
*/
function cs_display_product_tab() {
// Get current product info.
global $product;
?>
<!-- Example -->
<pre>
<?php print_r($product); ?>
</pre>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment