Last active
October 13, 2015 21:38
-
-
Save claudiosanches/4259294 to your computer and use it in GitHub Desktop.
WooCommerce - Add new tab in products
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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