Adding Custom Tabs to the WooCommerce Single Product Page

WooCommerce, one of the most powerful e-commerce platforms for WordPress, offers great flexibility in customizing product pages. Sometimes, you might need to add more information to your product pages—details that don’t fit into the standard description, reviews, or additional information sections. This is where custom product tabs come in handy. In this post, I’ll show you how to add custom tabs to WooCommerce single product pages using plugins and code snippets.

Why Add Custom Tabs?

Custom tabs allow you to:

  • Provide additional product information (e.g., specifications, care instructions).
  • Add a FAQ section or display customer reviews in a separate tab.
  • Integrate downloadable documents or guides.
  • Showcase special offers, warranties, or customer testimonials.

Adding custom tabs not only enhances the user experience but can also improve product page layout and readability.

Option 1: Using Plugins to Add Custom Tabs

If you’re not comfortable with coding, WooCommerce provides several plugins that allow you to add and manage custom tabs on your product pages.

Recommended Plugins for Custom Tabs

  1. WooCommerce Custom Product Tabs Lite
  • This free plugin allows you to easily create custom tabs for individual products. You can set custom tabs per product, reorder tabs, and remove default WooCommerce tabs.
  • The premium version offers features like global tabs that apply to multiple products.
  1. Custom Product Tabs for WooCommerce
  • Another popular plugin, which lets you add custom tabs that are product-specific or global (appearing across multiple products). The user interface is simple and effective.
  1. WooCommerce Tab Manager
  • This premium plugin allows complete customization of product tabs. You can create global tabs, reorder default WooCommerce tabs, and even add tabs via shortcodes. If you need more control over the tab content, this is a great option.

How to Add a Custom Tab Using WooCommerce Custom Product Tabs Lite

  1. Install and activate the WooCommerce Custom Product Tabs Lite plugin from the WordPress plugin repository.
  2. Go to the WooCommerce product editor page.
  3. Scroll down to the “Product Data” section, and you’ll notice a new ‘Custom Tabs’ option.
  4. From here, you can add a new tab, define its title, and add content (text, images, videos).
  5. Hit Save and view your updated product page with the new tab.

This method is easy, fast, and ideal for users who don’t want to deal with coding.


Option 2: Adding Custom Tabs via Code Snippets

If you’re comfortable editing code, WooCommerce also allows you to manually add custom tabs through your theme’s functions.php file or a custom plugin. The advantage of this approach is that you have full control over the layout, content, and style of your tabs.

Code Example: Adding a Custom Tab

Here’s a step-by-step guide to adding a custom tab using code:

  1. Open your WordPress dashboard and navigate to Appearance > Theme File Editor.
  2. Edit your theme’s functions.php file or create a child theme (to prevent losing changes during theme updates).
  3. Add the following code snippet to create a custom tab:
// Add a custom product tab
add_filter( 'woocommerce_product_tabs', 'custom_product_tab' );
function custom_product_tab( $tabs ) {

    // Add a new tab
    $tabs['custom_tab'] = array(
        'title'    => __( 'Custom Tab', 'your-textdomain' ),
        'priority' => 50,
        'callback' => 'custom_product_tab_content'
    );

    return $tabs;
}

// Content for the custom tab
function custom_product_tab_content() {
    echo '<h2>Custom Tab Content</h2>';
    echo '<p>Here is the content for your custom tab.</p>';
}
  1. Save the changes. When you view a product on the frontend, you’ll see a new tab labeled “Custom Tab” with the content defined in the custom_product_tab_content() function.

Adding Conditional Tabs

You can also make the custom tab appear conditionally, based on product categories, tags, or other criteria. For example, to show a custom tab only for products in a specific category:

add_filter( 'woocommerce_product_tabs', 'custom_tab_by_category' );
function custom_tab_by_category( $tabs ) {
    global $product;

    // Check if the product belongs to a specific category
    if ( has_term( 'special-category', 'product_cat', $product->get_id() ) ) {

        // Add the custom tab
        $tabs['special_tab'] = array(
            'title'    => __( 'Special Info', 'your-textdomain' ),
            'priority' => 50,
            'callback' => 'special_tab_content'
        );
    }

    return $tabs;
}

// Content for the special tab
function special_tab_content() {
    echo '<h2>Special Information</h2>';
    echo '<p>This tab appears only for products in the "Special Category".</p>';
}

Styling Custom Tabs

You might want to customize the appearance of your custom tabs to match your site’s design. Use the following CSS snippet to style your custom tabs:

/* Custom Tab Styling */
.woocommerce-tabs ul.tabs li.custom_tab a {
    background-color: #f5f5f5;
    color: #333;
}

.woocommerce-tabs .panel#tab-custom_tab {
    padding: 20px;
    background-color: #fafafa;
}

Add this CSS to your theme’s style.css file, or use a customizer tool.


Conclusion

Customizing product pages with additional tabs can greatly improve the user experience, help you communicate more detailed product information, and drive conversions. Whether you prefer using plugins for a simple solution or coding your tabs for full control, WooCommerce provides the flexibility you need.

Quick Summary:

By following these steps, you can easily enhance your WooCommerce product pages and provide more value to your customers.

If you need technical help with your WooCommerce store get in touch.

Photo by Davi Mendes on Unsplash

Get A No Obligation Quote

Do You Need Help With Your WooCommerce Site?

Click through to the next page and complete the form to get a free no obligation quote to fix any issue you are having with your WooCommerce site.