Want to display extra content on your WooCommerce product page? You can add a custom tab using a simple code snippet and a template file. Here’s how:
Step 1: Edit Your Theme’s Functions File
In the WordPress admin, go to Appearance > Theme Editor and open functions.php from your active theme.
Step 2: Insert Custom Tab Code
Add this code to register and display your new tab:
function custom_product_tab_content($tabs) {
$tabs['custom_tab'] = array(
'title' => __('Custom Tab', 'your-text-domain'),
'priority' => 50,
'callback' => 'custom_tab_content'
);
return $tabs;
}
add_filter('woocommerce_product_tabs', 'custom_product_tab_content');
function custom_tab_content() {
include('custom_product_tab.php');
}
Step 3: Build the Tab Content File
Create a file called custom_product_tab.php in your theme folder. Add any content you want to show — FAQs, galleries, size charts, etc.
Step 4: Upload the File
Make sure custom_product_tab.php is uploaded to the correct theme directory.
Step 5: Optional Styling
Apply custom styles in your main stylesheet or directly in the template file to make your tab visually consistent with the theme.
Step 6: Preview and Test
Save the changes and check a product page to confirm that your custom tab appears and functions properly.
Note: Use a child theme or plugin for these changes to prevent loss during theme updates. Always back up your site before editing theme files.
