Heads up! This article contains PHP code and is intended for developers. If you want to add new custom tabs on the WooCommerce products page without any code, I recommend checking out the Custom Product Tab Manager Plugin. The plugin allows you to add any number of custom tabs, assign each tab to specific products, categories, customers, and user roles. And much more…

Do you want to add new custom product tabs in WooCommerce? Product tabs are the tabs categorized with specific information about the product. By default, WooCommerce adds tabs “Description” & “Reviews”. In this article, we’re going to add a new custom product tab. Here’s a screenshot of the default Products tab for quick reference:

As we can see there are only two tabs which may not be enough for some products. You may have specific details or attributes about your products that don’t fit into the default tabs provided by WooCommerce, such as additional specifications or usage instructions. Adding a custom tab gives you the flexibility to tailor your product pages to your specific business needs and provide a better user experience for your customers. So, now let’s add a new tab.

To add a custom products tab and its corresponding contents in WooCommerce, we are going to use the woocommerce_product_data_tabs filter hook. Note that you’ll need to add both snippets. Categorization is only for readability.

1) Add Custom Products Tab

function add_custom_product_tab($tabs) {
    $tabs['custom_tab'] = array(
        'title'    => 'Custom Tab',
		'priority' => 50,
		'callback' => 'sa_custom_product_tab_content'
    );
    return $tabs;
}
add_filter('woocommerce_product_tabs', 'add_custom_product_tab');

2) Add the Tab’s Contents

function sa_custom_product_tab_content() {

    echo '<div id="custom_tab_content" class="panel woocommerce_options_panel">';
       echo '<div class="options_group">';

         echo '<p>This is the content for the custom tab.</p>';

       echo '</div>';
    echo '</div>';
}

Output

That’s all.🙏

Do you also want to add a new custom tab on the WooCommerce account page? There it is.

Add New Custom Product Tabs in WooCommerce
Tagged on:         

Sanjeev Aryal

Don't bury your thoughts, put your vision into reality ~ Bob Marley.

Leave a Reply

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

× WhatsApp