WooCommerce Custom Product Tabs

WooCommerce Product Page showing a custom product tab

Pre-Requisites

There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

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 '<h2>' . $tab['title'] . '</h2><p>Custom product tab content.</p>';
}
				
			

Snippet Benefits

  • Create a custom product tab and output any content.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

Your email address will not be published. Required fields are marked *

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers