This guide shows you how to create a custom product tab shown on the single product template. You may wish to output important shipping information, an unboxing video, links to social media, whatever you like! Keep in mind, this example output the very basics, static content across all products.
/**
* Snippet Name: WooCommerce Create A Custom Product Tab
* Snippet Author: ecommercehints.com
*/
add_filter( 'woocommerce_product_tabs', 'ecommercehints_custom_product_tab' );
function ecommercehints_custom_product_tab( $tabs ) {
$tabs['ecommercehints_custom_product_tab'] = array(
'title' => 'Custom Product Tab',
'callback' => 'ecommercehints_custom_product_tab_content',
'priority' => 40, // Description is 10, Additional Information is 20, Reviews is 30. 40 means it will appear last. 15 means it will appear between description and additional information etc.
);
return $tabs;
}
function ecommercehints_custom_product_tab_content( $slug, $tab ) {
echo '' . $tab['title'] . '
Custom product tab content.
';
}